The way I usually do this is to ensure that vim is in insert mode, select the text in Firefox (or whatever) and then middle click in vim - this is called the X11 selection, and is very handy.
You can also use the * and + buffers. So to paste from the X11 buffer into vim you can do (inside vim):
"*p
And if you have done Ctrl+C (or right click and "Copy") then you could do:
"+p
(Note that as usual, lower case p will paste after the cursor, and upper case P will paste before the cursor).
Note that "* and "+ work both ways. So if you have selected text in visual mode in vim, you can copy it to the X11 selection using "*y or to the standard clipboard using "+y.
I used "Shift-Insert" earlier today with text copied from firefox and pasted into a terminal (vi) for a co-worker stuck with the same issue on 11.. Not sure what needs to be changed in gvim to sync up the clipboards.
It will take your clipboard (where things end up after pressing ctrl-C, generally) and move it to your primary X selection (what you paste when you press the middle mouse button). So you can then press the middle mouse button to paste into VIM, GVIM or any other application.
The way I usually do this is to ensure that vim is in insert mode, select the text in Firefox (or whatever) and then middle click in vim - this is called the X11 selection, and is very handy.
You can also use the
*
and+
buffers. So to paste from the X11 buffer into vim you can do (inside vim):And if you have done Ctrl+C (or right click and "Copy") then you could do:
(Note that as usual, lower case
p
will paste after the cursor, and upper caseP
will paste before the cursor).Note that "* and "+ work both ways. So if you have selected text in visual mode in vim, you can copy it to the X11 selection using
"*y
or to the standard clipboard using"+y
.I used "Shift-Insert" earlier today with text copied from firefox and pasted into a terminal (vi) for a co-worker stuck with the same issue on 11.. Not sure what needs to be changed in gvim to sync up the clipboards.
@Hamish's answer is nice and works fine for VIM. Another way, perhaps more general, is to use
xclip
(apt-get install xclip
).Run this (or, more realistically, bind it to some key):
It will take your clipboard (where things end up after pressing ctrl-C, generally) and move it to your primary X selection (what you paste when you press the middle mouse button). So you can then press the middle mouse button to paste into VIM, GVIM or any other application.