Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot paste from clipboard in neovim nightly

Tags:

neovim

after uninstalling latest and installed nightly I cannot paste from clipboard, double checked my init.vim for set clipboard=unnamedplus

any suggestion?

update 21st May

following Matt's comment, running :checkhealth provider outputs

health#provider#check
========================================================================
## Clipboard (optional)
  - WARNING: No clipboard tool found. Clipboard registers (`"+` and `"*`) will not work.
    - ADVICE:
      - :help clipboard

so I run sudo apt-get install -y xclip

and works well (even with wayland!)

health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: xclip

like image 770
Francesco Iapicca Avatar asked Sep 13 '25 14:09

Francesco Iapicca


1 Answers

Neovim doesn't have any code to access OS clipboard directly (or to process X Window events). Instead it delegates to external utilities/plugins. You're expected to execute :checkhealth command to see the current state. If you don't have any supported tool on your PATH then you'll not be able to access the clipboard.

As a shameless plug, I wrote plugin that consists of dynamic library providing direct access to clipboard. This is to avoid extra process creation for every copy/paste operation (btw. setting clipboard=unnamed[plus] is bad for more than just this single reason). However, the library must be built from source before use.

As of Wayland, its IPC mechanism is clearly different from X but at least in GNOME or KDE you may expect both selections being synchronized transparently. Otherwise you need specific utils to access Wayland clipboard, such as wl-copy/wl-paste.

like image 199
Matt Avatar answered Sep 15 '25 17:09

Matt