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?