diff options
author | jluehrs2 <jluehrs2@uiuc.edu> | 2008-04-25 00:38:58 -0500 |
---|---|---|
committer | jluehrs2 <jluehrs2@uiuc.edu> | 2008-04-25 00:38:58 -0500 |
commit | 6056155c2f6e310dec5b8dc5fa094ab5e9f57b9e (patch) | |
tree | 4960cc7269a9976e4cca0190a08b6340f802ceab | |
parent | 0cf0ec12e02f3f85bf7016fa1d2e390b88bb2d32 (diff) | |
download | vim-textobj-6056155c2f6e310dec5b8dc5fa094ab5e9f57b9e.tar.gz vim-textobj-6056155c2f6e310dec5b8dc5fa094ab5e9f57b9e.zip |
add a fold text object
-rw-r--r-- | vimrc | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -332,6 +332,25 @@ onoremap <silent>i/ <Esc>:<C-U>call Textobj_regex(1, v:operator)<CR> xnoremap <silent>a/ <Esc>:<C-U>call Textobj_regex(0, 'v')<CR> 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' + + if a:inner == 0 + normal! dd + endif +endfunction +onoremap <silent>af <Esc>:<C-U>call Textobj_fold(0, v:operator, v:prevcount)<CR> +onoremap <silent>if <Esc>:<C-U>call Textobj_fold(1, v:operator, v:prevcount)<CR> +xnoremap <silent>af <Esc>:<C-U>call Textobj_fold(0, 'v', v:prevcount)<CR> +xnoremap <silent>if <Esc>:<C-U>call Textobj_fold(1, 'v', v:prevcount)<CR> +" }}} " }}} " Folding {{{ |