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?
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.
"+
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).
Oct 26, 2011 at 20:35
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
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.