diff options
author | jluehrs2 <jluehrs2@uiuc.edu> | 2008-04-28 01:25:40 -0500 |
---|---|---|
committer | jluehrs2 <jluehrs2@uiuc.edu> | 2008-04-28 01:25:40 -0500 |
commit | 246b0a52a55eac622826464d35f4f6a45074363d (patch) | |
tree | 61446396c3a41195a1e2b553fac718b25a59e2f5 /vimrc | |
parent | eaf1d6f1223d8f848cade4f2d7dd0e89e0e8cc49 (diff) | |
download | conf-246b0a52a55eac622826464d35f4f6a45074363d.tar.gz conf-246b0a52a55eac622826464d35f4f6a45074363d.zip |
convert the fold text object to use the new helper function
Diffstat (limited to 'vimrc')
-rw-r--r-- | vimrc | 26 |
1 files changed, 10 insertions, 16 deletions
@@ -697,24 +697,18 @@ endfunction call Textobj('/', 'Textobj_regex') " }}} " f for folds {{{ -function Textobj_fold(inner, operator, count) +function Textobj_fold(inner, count) + let pos = getpos('.') + exe 'normal! '.a:count.'[z' - let startpos = line('.') + a:inner + let startline = line('.') + a:inner normal! ]z - let endpos = line('.') - a:inner - exe 'normal! '.startpos.'G' - exe 'normal! '.a:operator.endpos.'G' - - if a:operator == 'c' - normal! l - startinsert - elseif a:operator == 'v' - normal! $ - endif + let endline = line('.') - a:inner + + call setpos('.', pos) + + return [startline, 1, endline, strlen(getline(endline))] endfunction -onoremap <silent>af <Esc>:call Textobj_fold(0, v:operator, v:prevcount)<CR> -onoremap <silent>if <Esc>:call Textobj_fold(1, v:operator, v:prevcount)<CR> -xnoremap <silent>af <Esc>:call Textobj_fold(0, 'v', v:prevcount)<CR> -xnoremap <silent>if <Esc>:call Textobj_fold(1, 'v', v:prevcount)<CR> +call Textobj('f', 'Textobj_fold') " }}} " }}} |