Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 ?

share|improve this question
add comment

3 Answers

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

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

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.