Charlie Harvey

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

I’m a huge fan of the Vimperator Firefox plugin. 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 Vimperator cut and paste tip on superuser. I’ve extended the tip so that it works in all of the Vim modes.

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>

You can read more about key mapping in Vim if you're not clear whats going on here.


Comments

  • You can use strong, em, code, pre, q and a HTML tags.
  • Comment and email are the only required fields.
  • Be respectful. You may want to read the comment guidelines before posting.

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.