Wikia

Vim Tips Wiki

Changes: Copy an Entire Buffer to the Clipboard

Edit

Back to page

(added another method to copy all code to buffer on mac)
m
 
Line 69: Line 69:
 
<Cmd-A><Cmd-C>
 
<Cmd-A><Cmd-C>
 
</pre>
 
</pre>
  +
   
 
<pre>
 
<pre>

Latest revision as of 03:40, March 25, 2014

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>


:w !pbcopy

ReferencesEdit

CommentsEdit

Around Wikia's network

Random Wiki