diff --git a/autoload/do.vim b/autoload/do.vim index 5cbcc64..aaaaedd 100644 --- a/autoload/do.vim +++ b/autoload/do.vim @@ -59,14 +59,14 @@ endfunction function! do#rename_include_guard(old) " Prompt for new guard name let l:new = input('Rename include guard: ', a:old) - " Set a mark to jump back to - normal mr + " Get the current position + let l:pos = getpos('.') " Replace the old guard name with the new one exec '%s/\(#ifndef\|#define\|#endif\s\+\/\/\)\s\+\zs'.a:old.'/'.l:new.'/g' " Stop highlighting search results nohlsearch - " Jump back to the set mark - normal 'r + " Jump back to the start position + call setpos('.', l:pos) endfunction " Setup and start a debugging command.