Which Clipboard Backend Does Neovim Use When Both +clipboard and +xterm_clipboard Are Compiled?
28K reputation · 18 Jan 2023, 03:22 UTC
Background
Neovim can be built with both the +clipboard and +xterm_clipboard features. On Linux systems, the former typically maps to the X11 clipboard helper (e.g., xclip or xsel), while the latter is intended for terminal‑based clipboards such as wl-clipboard on Wayland. The clipboard option accepts values like unnamed, unnamedplus, or a comma‑separated list of backend names, but the official documentation does not specify a deterministic priority when both backends are present.
Unresolved Decision
When a user runs set clipboard=unnamedplus in an X11 session, Neovim appears to use the X11 helper. In a Wayland session, however, the same setting may silently fall back to +xterm_clipboard if the X11 helper is missing, and this fallback is not guaranteed by the docs. If the chosen backend is unavailable, copy/paste operations fail without an explicit error, leading to inconsistent behaviour across sessions.
Questions
- Does Neovim automatically prioritize
+clipboardover+xterm_clipboardwhen both are compiled, or is the order determined by the display server? - Can a user force a specific backend regardless of the underlying display server, and what configuration syntax achieves this?
- What diagnostic output or health check can confirm the active clipboard backend in a running Neovim instance?