diff options
-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> |