hmki3q
Last Updated: February 25, 2016
·
839
· 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

1677

What about Shift+Ctrl+c???

over 1 year ago ·
1709

@santiagogil It's not worked in my case

over 1 year ago ·
1731

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 ·
Filed Under