diff options
author | jluehrs2 <jluehrs2@uiuc.edu> | 2008-04-25 01:35:11 -0500 |
---|---|---|
committer | jluehrs2 <jluehrs2@uiuc.edu> | 2008-04-25 01:35:11 -0500 |
commit | a5d22cad51c1ca01ad433d8c7c69fead0cfe3ed9 (patch) | |
tree | 5d7c3180c8b5099126e0590a4031dd68d1a8a543 | |
parent | 6056155c2f6e310dec5b8dc5fa094ab5e9f57b9e (diff) | |
download | vim-textobj-a5d22cad51c1ca01ad433d8c7c69fead0cfe3ed9.tar.gz vim-textobj-a5d22cad51c1ca01ad433d8c7c69fead0cfe3ed9.zip |
hmmm, how about a fold textobj that actually works
-rw-r--r-- | vimrc | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -334,16 +334,18 @@ xnoremap <silent>i/ <Esc>:<C-U>call Textobj_regex(1, 'v')<CR> " }}} " f for folds {{{ function Textobj_fold(inner, operator, count) - if a:inner == 1 - let pos = getpos('.') - exe 'normal! '.a:count.'[zyyp' - call setpos('.', pos) - endif - - exe 'normal! '.a:count.']z'.a:operator.'[z' + exe 'normal! '.a:count.'[z' + let startpos = line('.') + a:inner + normal! ]z + let endpos = line('.') - a:inner + exe 'normal! '.startpos.'G' + exe 'normal! '.a:operator.endpos.'G' - if a:inner == 0 - normal! dd + if a:operator == 'c' + normal! l + startinsert + elseif a:operator == 'v' + normal! $ endif endfunction onoremap <silent>af <Esc>:<C-U>call Textobj_fold(0, v:operator, v:prevcount)<CR> |