diff options
author | jluehrs2 <jluehrs2@uiuc.edu> | 2008-04-30 00:54:53 -0500 |
---|---|---|
committer | jluehrs2 <jluehrs2@uiuc.edu> | 2008-04-30 00:54:53 -0500 |
commit | 8c7f5761d601115f0c83cd6da7129c44d9b87d86 (patch) | |
tree | 3a150b890f2efb0ec0276e191117ef0acc125368 | |
parent | 56c55d59531340bad9c3a13222c5ffec58176970 (diff) | |
download | vim-textobj-8c7f5761d601115f0c83cd6da7129c44d9b87d86.tar.gz vim-textobj-8c7f5761d601115f0c83cd6da7129c44d9b87d86.zip |
move the save/restore of cursor position to the base text object function
-rw-r--r-- | vimrc | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -287,9 +287,12 @@ function Textobj(char, callback) let g:text_object_number += 1 function Textobj_{g:text_object_number}(inner, operator, count, callback) try + let pos = getpos('.') let [startline, startcol, endline, endcol] = function(a:callback)(a:inner, a:count) catch /no-match/ return + finally + call setpos('.', pos) endtry if startline == endline let objlength = endcol - startcol + 1 @@ -389,12 +392,10 @@ 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 |