19

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

4
  • :checkhealth provider
    – Matt
    Commented May 21, 2021 at 17:49
  • fixed thanks to you, if you make it an answer I'll accept it immediately Commented May 21, 2021 at 20:03
  • 2
    I'm surprised that I didn't have any clipboard provider that neovim could use automatically. I'm using Ubuntu 22.04. I had xclipboard installed by default. I too installed xclip and neovim was happy again.
    – icc97
    Commented Feb 22, 2023 at 2:59
  • It works as mentioned. running actualy LazyVim in Ubuntu 22.04.2 LTS
    – Joel Orzet
    Commented Jun 16, 2023 at 22:49

1 Answer 1

9

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.