From 8c7f5761d601115f0c83cd6da7129c44d9b87d86 Mon Sep 17 00:00:00 2001 From: jluehrs2 Date: Wed, 30 Apr 2008 00:54:53 -0500 Subject: move the save/restore of cursor position to the base text object function --- vimrc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vimrc b/vimrc index 9608e09..12d3937 100644 --- a/vimrc +++ b/vimrc @@ -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 -- cgit v1.2.3