How do I copy the entire current line to the system clipboard?
Answer
"+yy
Explanation
The "+yy command yanks the current line directly to the system clipboard register, making it available for pasting in other applications.
How it works
"+specifies the system clipboard registeryyyanks the entire current line- The line is now in the system clipboard
Example
With the cursor on a line containing export PATH=$HOME/bin:$PATH, pressing "+yy copies it. You can then paste it in a terminal with Ctrl+V.
Tips
"+y{motion}copies specific text to clipboard"*is the X11 primary selection (middle-click paste on Linux):set clipboard=unnamedplusmakes all yanks go to clipboard- Check support with
:echo has('clipboard') - In WSL or SSH, you may need additional tools like
xclip