Is there any way to copy all lines from open file to clipboard in VI editor. I tried yG
but its not using clipboard to store those lines.
So is it possible?
Is there any way to copy all lines from open file to clipboard in VI editor. I tried yG
but its not using clipboard to store those lines.
So is it possible?
The clipboard is buffer +
. To copy to clipboard, do "+y[movement]
. So, gg"+yG
.
Similarly, to paste from clipboard, "+p
You should yank the text to the *
or +
registers:
gg"*yG
Explanation:
gg
"*y
*
from the first line, until...G
If you're using Vim in visual mode, the standard cut and paste keys also apply, at least with Windows.
Under Ubuntu terminal (Gnome) at least, the standard copy also works (CTRLSHIFTC, although there doesn't appear to be a standard keyboard shortcut for select all
(other than ALTE followed by A).
There wasn't a concept of "clipboard" in Bill Joy's vi so I don't think there is a built-in way to do it.
gVim's automatic copy-anything-highlighted-to-the-clipboard feature is easiest or use an external program via :!
For Cygwin's vim I use
:%!putclip
u
Maybe Ubuntu has a CLI app like putclip??