I have a function which takes a string of commands to execute and makes sure 'paste'
is on before it runs them. What I'm looking for is akin to the following:
vmap <silent> <C-K> :<C-U>call InPasteMode("<Plug>ReplaceVisual")<CR>
function! InPasteMode(command)
let oldpaste = &l:paste
try
set paste
execute "normal" a:command
finally
let &l:paste = oldpaste
endtry
endfunction
but the command, "<Plug>ReplaceVisual"
, needs to run in Visual mode, not Normal mode.
Is there a command like :normal
which runs keystrokes in Visual mode?
gv
restores the last visual selection. So, something like execute "normal gv" . a:command
execute "normal gv" . a:command
should work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.