How to support clipboard for NeoVim

Hello, I find that the default neovim is not compiled with +clipboard (checked with nvim --version), how can I get a version with the clipboard support, is there any example configuration.nix to reference?

2 Likes

neovim clipboards are configured at runtime via “providers” (check :h providers). In general, neovim removed most compilation flags compared to vim to reduce complexity (and I mean why would you want to disable multibyte encoding ? even vim removed it now).

If you are using Linux, you need to install xclip if using X11 or wl-copy and wl-paste if using Wayland.

8 Likes

doing "+y<movement> seems to work to copy into my system clipboard

It worked with xclip installed, thanks a lot!

xclip is necessary in any distro to enable X11 clipboard in Neovim. Maybe some distros add xclip as dependency of Neovim. In Ubuntu, if I remember well, xclip is not marked as dependency of Neovim.

you can add your own clipboard provider (there are for tmux for instance), default ones are at https://github.com/neovim/neovim/blob/77dc891bfbdcdb84f919f6ff5b535b385c121007/runtime/autoload/provider/clipboard.vim