summaryrefslogtreecommitdiffstats
path: root/vimrc
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2008-04-28 01:25:40 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2008-04-28 01:25:40 -0500
commit246b0a52a55eac622826464d35f4f6a45074363d (patch)
tree61446396c3a41195a1e2b553fac718b25a59e2f5 /vimrc
parenteaf1d6f1223d8f848cade4f2d7dd0e89e0e8cc49 (diff)
downloadconf-246b0a52a55eac622826464d35f4f6a45074363d.tar.gz
conf-246b0a52a55eac622826464d35f4f6a45074363d.zip
convert the fold text object to use the new helper function
Diffstat (limited to 'vimrc')
-rw-r--r--vimrc26
1 files changed, 10 insertions, 16 deletions
diff --git a/vimrc b/vimrc
index 771240a..4feb0bd 100644
--- a/vimrc
+++ b/vimrc
@@ -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')
" }}}
" }}}