vim-textobj-nl

Please note that this plugin is still in development

Motion for "next/last object". "Last" here means "previous", not "final". Unfortunately the p motion was already taken for paragraphs.

Next acts on the next object of the given type, last acts on the previous object of the given type. These don't necessarily have to be in the current line.

Currently works for (, [, { (and their respective shortcuts b, r, B) and single- and double-quotes.

Some examples (C marks cursor positions, V means visually selected):

din': delete in next single quotes

foo = bar('spam')
C
foo = bar('')
          C

canb: change around next parens

foo = bar('spam')
C
foo = bar
         C

vin": select inside next double quotes

print "hello ", name
 C
print "hello ", name
       VVVVVV

Installation

Depends on kana/vim-textobj-user.

If you have Vundle, you can use

Bundle 'kana/vim-textobj-user'
Bundle 'ashleyh/vim-textobj-nl'

Tests

There are some tests, written using vader. There is a script to run the tests at ./test/run.sh. It will try to sort out the test dependencies for you. If you run it you will (hopefully) find yourself in vim with a screenful of test results.

Build Status

Credit

I got the idea from Steve Losh's vimrc, and adapted his comments into this README.