Charlie Harvey

Vimperator Tip: Cut and paste with ctrl—c/ctrl—v

<p>I&#8217;m a huge fan of the <a href="http://www.vimperator.org/vimperator">Vimperator Firefox plugin</a>. It works just like you'd want it to and doesn't break much. Well, it breaks one useful thing, which is the almost universal ctrl-c/ctrl-v cut and paste shortcuts. So, I was well chuffed to find a <a href="http://superuser.com/questions/12681/vimperator-copy-pasting">Vimperator cut and paste tip</a> on <a href="http://superuser.com">superuser</a>. I&#8217;ve extended the tip so that it works in all of the Vim modes.</p> 

What you need to do is tweak your ~/.vimperatorrc file (create it if it doesn't exist) to tell it how to deal with those shortcuts. Ctrl-v normally puts Vimperator into "Pass Next" mode — passing the subsequent keystroke through to Firefox rather than trying to make sense of it. We remap out ctrl-c and ctrl-v, inserting ctrl-v before each which passes the keystrokes to Firefox to be dealt with as expected. Here's the lines you'll need to add to ~/.vimperatorrc. noremap <C-v> <C-v><C-v> inoremap <C-v> <C-v><C-v> cnoremap <C-v> <C-v><C-v> noremap <C-c> <C-v><C-c> inoremap <C-c> <C-v><C-c> cnoremap <C-c> <C-v><C-c>

<p>You can read more about <a href="http://how-to.wikia.com/wiki/How_to_map_keys_in_vim">key mapping in Vim</a> if you're not clear whats going on here.</p>


Comments

  • Be respectful. You may want to read the comment guidelines before posting.
  • You can use Markdown syntax to format your comments. You can only use level 5 and 6 headings.
  • You can add class="your language" to code blocks to help highlight.js highlight them correctly.

Privacy note: This form will forward your IP address, user agent and referrer to the Akismet, StopForumSpam and Botscout spam filtering services. I don’t log these details. Those services will. I do log everything you type into the form. Full privacy statement.