Vim Tips Wiki
Register
(The first suggestion for Ex Mode works in Normal Mode too.)
(Undo revision 32164 by 193.15.95.2 (talk) yeah, it works...but it's an Ex command not a normal one, that's why it was in that section)
Line 18: Line 18:
   
 
<pre>
 
<pre>
:%y+
 
 
 
gg"*yG
 
gg"*yG
 
gg"+yG
 
gg"+yG

Revision as of 15:46, 30 November 2011

Tip 960 Printable Monobook Previous Next

created July 20, 2005 · complexity basic · author Ivan Tishchenko · version 5.7


Vim can access two different clipboard registers: * (primary selection) and + (clipboard). On Windows, either one can be used.

There are a number of ways of copying the entire contents of a file to the clipboard. These include:

Normal Mode

gg"*yG
gg"+yG

:set go+=a
ggVG
ggVGy

:set cb+=unnamed
ggyG

Ex Mode

:%y+

:set cb+=unnamed
:%y

Visual Mode (linewise)

ggoG"+y

:set go+=a
ggoG

Visual Mode (characterwise or blockwise)

VggoG"+y

:set go+=a
VggoG


Windows Specific (with Windows key bindings in effect)

ggVG<c-ins>
<C-A><C-C>

Macintosh Specific

<Cmd-A><Cmd-C>

References

Comments