I found that I can not paste text to GVIM from firefox or other editor, anyone can tell me how to set my GVIM(GNOME) on Ubuntu11 ?

3 Answers 3


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 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.


@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):

 xclip -selection clipboard -o | xclip -selection primary -i

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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