Learn Vim / How to Copy to the System Clipboard in Vim

How to Copy to the System Clipboard in Vim

The answerPrefix your yank with the + register: "+yy copies the line to the system clipboard. Paste from it with "+p.

Vim's registers are separate from the OS clipboard by design. The + register is the bridge. If you always want them linked, add set clipboard=unnamedplus to your vimrc (requires clipboard support — check with vim --version | grep clipboard).

All the ways

KeysWhat it does
"+yycopy the line to the system clipboard
"+ppaste from the system clipboard
ggVG"+ycopy the whole file to the system clipboard
set clipboard=unnamedplusvimrc: use the system clipboard for everything

Reading about keystrokes doesn't build keystrokes. Try this in a real vim buffer right now — the “Take everything” mission takes about a minute.

Practice free — no signup →

Keep going