title: How do I execute Visual mode commands from a Vim function?
body: <p>I have a function which takes a string of commands to execute and makes sure <code>'paste'</code> is on before it runs them.  What I'm looking for is akin to the following:</p>
  
  <pre><code>vmap &lt;silent&gt; &lt;C-K&gt; :&lt;C-U&gt;call InPasteMode("&lt;Plug&gt;ReplaceVisual")&lt;CR&gt;
  function! InPasteMode(command)
    let oldpaste = &amp;l:paste
    try
      set paste
      execute "normal" a:command
    finally
      let &amp;l:paste = oldpaste
    endtry
  endfunction
  </code></pre>
  
  <p>but the command, <code>"&lt;Plug&gt;ReplaceVisual"</code>, needs to run in Visual mode, not Normal mode.</p>
  
  <p>Is there a command like <code>:normal</code> which runs keystrokes in Visual mode?</p>