Last Updated: February 25, 2016
·
1.45K
· 8xx8ru

VIM Copy/Paste

Easily copy to the system clipboard in vim?

Yes! (Ubuntu/Mint)

Install xclip:

sudo apt-get install xclip

Add bindings to .vimrc

vmap <c-c> y:call system("xclip -i -selection clipboard", getreg("\""))<cr>:call system("xclip -i", getreg("\""))<cr>
nmap <c-v> :call setreg("\"",system("xclip -o -selection clipboard"))<cr>p")")")"))

3 Responses
Add your response

What about Shift+Ctrl+c???

over 1 year ago ·

@santiagogil It's not worked in my case

over 1 year ago ·

Vim actually has a special register for the system clipboard, '+'. So you can copy to and from the system clipboard like so:

"+p -> paste from clipboard
"+y -> yank to clipboard

over 1 year ago ·