Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm using gvim for text editing.

Some shortcuts are listed as

Cut +y
Paste "+gP

However those precise key combinations do not work so I suppose that + and g might be abbreviations for other shortcuts. How can I figure this one out?

share|improve this question

2 Answers 2

It's "+y, not +y

The "+ prefixes tell vim to use the X11 clipboard instead of vim's internal clipboard. You only need them if you want to exchange text with other programs.

Usually you can just use y to yank the marked text (if you are in visual mode) or append some move commands to yank a text range, like y2w to yank the next two words. Then use p or gP to paste the yanked text before (p) or after (gP) the cursor. gP moves the cursor behind the new text while g sets it at the start of the new text.

As gvim, like any other vi derivative, isn't intuitive to use you really should read the handbook in the Help menu.

share|improve this answer
    
My question probably wasn't clear enough. How can I use the X11 clipboard from inside gvim? I am familiar with vim commands, but I fail to use the clipboard from window to window (or gvim instance to gvim instance if you will). –  Eric Oct 26 '11 at 20:10
    
Use the "+ prefix (e.g. "+p) to access the X11 clipboard (used by most programs with Ctrl-C/Ctrl-V) and "* (e.g. "*p) to access the X11 primary selection (the content you can usually insert by pressing the middle mouse button). –  Florian Diesch Oct 26 '11 at 20:35

The confusion here is that you might be pressing those keyboard combinations in editing mode.

Make sure you are not in editing mode before doing exactly that. Type, one by one:

"

+

G

P

Then when you press enter it will copy what's in your clipboard.

share|improve this answer

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.