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) function! do#rename_include_guard(old)
" Prompt for new guard name " Prompt for new guard name
let l:new = input('Rename include guard: ', a:old) let l:new = input('Rename include guard: ', a:old)
" Set a mark to jump back to " Get the current position
normal mr let l:pos = getpos('.')
" Replace the old guard name with the new one " Replace the old guard name with the new one
exec '%s/\(#ifndef\|#define\|#endif\s\+\/\/\)\s\+\zs'.a:old.'/'.l:new.'/g' exec '%s/\(#ifndef\|#define\|#endif\s\+\/\/\)\s\+\zs'.a:old.'/'.l:new.'/g'
" Stop highlighting search results " Stop highlighting search results
nohlsearch nohlsearch
" Jump back to the set mark " Jump back to the start position
normal 'r call setpos('.', l:pos)
endfunction endfunction
" Setup and start a debugging command. " Setup and start a debugging command.