DEV Community

Alex Gonzalez Lacasa
Alex Gonzalez Lacasa

Posted on

VIM / NeoVim and the clipboard (in Linux)

First check is your vim installation is enabled to access to the system clipboard.

:checkhealth
Enter fullscreen mode Exit fullscreen mode

This show posible warnings like

Clipboard (optional)
- WARNING No clipboard tool found. Clipboard registers ("+ and "*) will not work.
  - ADVICE:
    - :help clipboard
Enter fullscreen mode Exit fullscreen mode

try to put in ~/.config/nvim/init.vim

set clipboard=unnamedplus
Enter fullscreen mode Exit fullscreen mode

If the clipboard still isn't working and your graphical environment uses Wayland, install:
wl-clipboard

sudo apt install wl-clipboard
Enter fullscreen mode Exit fullscreen mode

At least in my case the clipboard between applications already works.

And remember, in VISUAL mode
y for copy
p for paste

Top comments (1)

Collapse
 
saltaformajo profile image
Saltaformajo

I'm using different mappings for neovims clipboard and system clipboard, so when I delete something in neovim, I know that my system clipboard untouched and I can paste one thing or another, depending what I need.

github.com/coffebar/dotfiles/blob/...