aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2008-04-30 00:50:29 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2008-04-30 00:50:29 -0500
commit56c55d59531340bad9c3a13222c5ffec58176970 (patch)
tree22e34a1dcecd5affe46bc7db1b563f33e0b45ddc
parent0bcdc704f2a0c3100c43ce18cdc0e4ec95f5fd65 (diff)
downloadvim-textobj-56c55d59531340bad9c3a13222c5ffec58176970.tar.gz
vim-textobj-56c55d59531340bad9c3a13222c5ffec58176970.zip
save and restore the cursor position in the fold text object, so it has no side effects
-rw-r--r--vimrc2
1 files changed, 2 insertions, 0 deletions
diff --git a/vimrc b/vimrc
index e629abc..9608e09 100644
--- a/vimrc
+++ b/vimrc
@@ -389,10 +389,12 @@ call Textobj('/', 'Textobj_regex')
" }}}
" f for folds {{{
function Textobj_fold(inner, count)
+ let pos = getpos('.')
exe 'normal! '.a:count.'[z'
let startline = line('.') + a:inner
normal! ]z
let endline = line('.') - a:inner
+ call setpos('.', pos)
return [startline, 1, endline, strlen(getline(endline))]
endfunction