Don't use normal mode mappings in vimscript

This commit is contained in:
Kenneth Benzie 2018-09-14 16:37:14 +01:00
parent 992096a2a0
commit c326a04f70

View File

@ -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.