My website has moved to a new address: hund.tty1.se

How to copy text to the clipboard in Neovim | Hund

Hund

How to copy text to the clipboard in Neovim

Tuesday, June 30, 2020

My website has moved to a new address: hund.tty1.se

If you want to copy text to the clipboard in Neovim you can do so with xclip. The command is a bit complicated so I highly recommend you binding it to a shortcut.

This is what I have in my Neovim configuration to let me copy marked text using Ctrl+C:

vmap <C-c> y:call system("xclip -i -selection clipboard", getreg("\""))<CR>:call system("xclip -i", getreg("\""))<CR> 

Just make sure to install the tool xclip if you don’t already have it.

Meta

Feedback

If you want to leave feedback, you can do so by either sending me an email or by commenting on this post on Mastodon.