System Clipboard

If you want to use the system clipboard when you copy (or yank) then its pretty easy in neovim but can be complicated when it comes to vim.

With Neovim

vim.o.clipboard = 'unnamedplus'

Vim as I said can be a little more complicated depending on the vim package you have installed but I will cover that a little further below. First however lets check if you need to change your package:

If you run the following:

:echo has('clipboard')

If it returned a 1 then that's great and you can add the following to your .vimrc

set clipboard=unnamedplus

If it returned a 0 then you will need to look for a package that supports the system clipboard on your OS or although I do not recommend this for newer users; compile it with the clipboard option. Once you have the correct package then run the above command again and add the required setting to your .vimrc.

These packages are known to work with the clipboard: