Shortcuts in gvim
Solution 1
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.
Solution 2
By adding set clipboard=unnamedplus
in your .vimrc or .gvimrc you can copy paste between instances of gvim with y
to yank and p
to paste
This also allows you to copy and paste between gvim and other programs
Solution 3
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.
Related videos on Youtube
Eric
Updated on September 18, 2022Comments
-
Eric over 1 year
I'm using gvim for text editing.
Some shortcuts are listed as
Cut +y
Paste "+gPHowever 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?
-
Eric over 12 yearsMy 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).
-
Christopher B. Adkins over 12 yearsUse 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).