" Stolen from Steve Losh " https://bitbucket.org/sjl/dotfiles/src/tip/vim/.vimrc " " Motion for "next/last object". For example, "din(" would go to the next "()" " pair and delete its contents. onoremap an :call NextTextObject('a', 'f') xnoremap an :call NextTextObject('a', 'f') onoremap in :call NextTextObject('i', 'f') xnoremap in :call NextTextObject('i', 'f') onoremap al :call NextTextObject('a', 'F') xnoremap al :call NextTextObject('a', 'F') onoremap il :call NextTextObject('i', 'F') xnoremap il :call NextTextObject('i', 'F') function! s:NextTextObject(motion, dir) let c = nr2char(getchar()) if c ==# "b" let c = "(" elseif c ==# "B" let c = "{" elseif c ==# "d" let c = "[" endif exe "normal! ".a:dir.c."v".a:motion.c endfunction