Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying out Vimperator. I mainly wanted it for the hjkl scrolling, and I like its "hint" system for following links. These two features are really all I need; I think.

I don't mind the other features, it just sometimes get in my way.

The thing that annoys me the most is copy/pasting. I'm used to Ctrl + c/Ctrl+v, I don't mind using another shortcut, but ..

:help yank indicates that copying selected text is done with Y, but the only method mentioned for pasting is the middle mouse button!

This is so ridiculously against the spirit of Vim!

How can I paste in Vimperator without using the mouse?

share|improve this question
add comment

7 Answers 7

up vote 12 down vote accepted

The best and easiest thing that you can do is to remap the keys. It's not hard. Put this into your _vimperatorrc (or .vimperatorrc in Linux)

noremap <C-c> <C-v><C-c>
noremap <C-v> <C-v><C-v>

<C-v> is by default mapped to "Pass next" mode, which means that next key you press is sent directly to Firefox, without being processed and eaten by vimperator. So the mappings above just activate the "Pass next" mode and send the respective shortcut.

There is even a vimperator plugin which extends this even further and remaps all common windows shortcuts, so they behave as expected.

share|improve this answer
2  
for <C-v> (paste) it should be inoremap –  hasenj Jul 31 '09 at 11:56
    
accepted for the plugin link! which is awesome and fixes the issue –  hasenj Jul 31 '09 at 12:05
1  
It looks like the current version (3.8.1) may have C-c and C-v doing OS-level copy and paste by default... I wasn't able to find anything about it in the changelogs, but I just switched from Pentadactyl to latest Vimperator and C-c and C-v worked like I wanted them to. –  seafangs Dec 28 '13 at 16:28
add comment

I'm surprised there wasn't a more accurate answer given to this question. The chosen answer's plugin link solved the OP's issue, but no one actually explained how to paste something into a text field without using the passthrough (C-v) mode.

If you are in a text field in INSERT mode and would like to paste something, the obvious thing to do in vi-land is to press ESC and p to paste. In vimperator, this doesn't work- ESC takes you out of INSERT mode completely and into the mode in which you work with the page/tab as a whole.

Vimperator solves this by having an additional BASIC mode- TEXTAREA. When in mode TEXTAREA, you can use the supported commands you'd use in vi.

Enter TEXTAREA mode: C-t
Paste:    p
Copy line:    yy
Delete Char:  x
Delete Line:  dd

Etc.

This doesn't appear to be well documented- I ended up figuring it mostly by mistake. It works the same in multiline and single line textboxes.

share|improve this answer
    
Thank you for this comment. This is exactly what I needed to get my head round vimperator and form fields. –  ZweiBlumen Mar 6 '12 at 7:16
    
@RevAaron when you enter TEXTAREA mode is this like the traditional VI envronment and most VI key would work for editing text? And also I noticed ( again by accident ) when I press "d" and then "s" or "a" in the TEXTAREA mode it turns the mode to the one called VISUAL. I would appreciate it if you could give me some info on this. or even if you like I can put it as a question then you can answer it then others would use it. –  Mehrad Feb 26 at 23:45
add comment

Right now, vimperator remaps both Ctrl+C (from 'copy' to 'cancel') and Ctrl+V (from 'paste' to 'pass-through'). On Linux, the preferred method of copy/paste is with the middle mouse button, so this is not a problem. On Windows, this is a user-interface disaster and it badly needs to be fixed.

There are three places you might copy from: text from a Web page, text from a form field, and text from an external application. There are two places you might copy to: into a form field, and into an external application. The address and command bars work like form fields.

Copying from...
     A web page: 'Y' works, '^C' doesn't
     Form field: 'Y' doesn't work, '^C' does
     Extern application: 'Y' doesn't work, '^C' does
  Copying to...
     Form field: '^V' doesn't work, '^V,^V' does
     External application: '^V' works, '^V,^V' pastes twice
 Or, seen another way
       Copy  Paste
 Page  Y     N/A
 Form  ^C    ^V,^V
 App   ^C    ^V

Ordinary users won't memorize that table. They'll never figure it out, because it's not documented explicitly, and they wouldn't read it even if it was. Instead, they'll use the right-click menu, the only thing that works everywhere. In fact, a few weeks after I started using Vimperator, I caught myself doing just that, in a completely unrelated application, something I had never done before.

We need to restore ^C and ^V to their original, rightful functions as copy and paste, which means displacing the ^C=cancel and ^V=pass-through hotkeys. In fact, both of these hotkeys are unique to vimperator and do not appear in vim. ^V means 'block visual' in vim, which doesn't apply in vimperator, so pass-through can be easily assigned to some other key. I suggest backslash in command mode and ctrl+backslash in both command and insert modes. That leaves ^C. I think that should be moved to ^S. This has two good mnemonics: it's 'stop', and it's also the Unix hotkey for XOFF, which is useless but semantically similar. ^S is currently "save page as" in vimperator, which is rarely used and can still be accessed with :save or :saveas.

Undo is also broken; it was ^Z, but ^Z is not pass-through mode and there's no way to undo edits in a form field without using the mouse. I see no reason not to move that to another hotkey, especially since ^Z in vim means suspend, which is completely unrelated, and unexpectedly finding yourself in pass-through mode is extremely disorienting. I can't think of a non-arbitrary hotkey to change this to, but ^Z was pretty arbitrary in the first place, so any unused hotkey will do.

Soruce : http://www.mozdev.org/pipermail/vimperator/2008-October/002359.html

share|improve this answer
add comment

I didn't find the answers given useful as I cannot see Ctrl+c anywhere. What I do is to use the SecureCRT shortcut. That is, for copying from the page:

Ctrl+Ins

For pasting: Ctrl+V twice (as somebody says in the answers elsewhere).

share|improve this answer
    
Thank you, kind sir. Mapping <c-c> to <c-ins> solved my particular flavour of this problem. –  eventualEntropy Jun 4 '13 at 0:35
add comment

Try the following if you'd rather have a mouseless experience than a full-on vim experience:

share|improve this answer
    
NextPlease is for FireFox 3.6 now :) –  Alexey Romanov Feb 10 '10 at 15:57
add comment

For a short answer - ^V^V (ie. Ctrl-V Ctrl-V)

The first Ctrl-V does "next keystroke pass through". The second Ctrl-V pastes the text. This is what I do for most text fields.

If you use the vi mode for multiline text fields (set noinsertmode), you can also paste using p - so if I wanted to paste the URL of another tab into this tag I can go to that tab, use y and then move back to this tab. The bottom bar of the browser will say -- TEXTAREA -- and I can press p to paste in the URL.

share|improve this answer
add comment

I've been looking for a way to do this for a while. Nice one. But the noremap solution from user4126 wasn't quite perfect if I wanted to paste into the commandline or into a text box as joe points out. So I tweaked it with inoremap,and cnoremap too over at http://charlieharvey.org.uk/page/vimperator_cut_and_paste . It doesn't look like vnoremap is supported.

So, you can paste into the commandline and into text boxes by using the ctrl-v shortcut only once. Paste the following in your .vimperatorrc and restart Firefox.

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>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.