Use tmux clipboard provider on Wayland

On Gnome Shell on Wayland `wl-copy` is automatically detected but using
it requires switching focus to the temporary invisible window it creates
as a workaround to the Wayland security feature that only the focused
application can interact with the clipboard. This does not happen when
`nvim` is run outside of `tmux`, so I can only assume that `tmux` is
seen to be the focused application, even though it's running inside
`kitty`, rather than `nvim` when running inside `tmux`.
This commit is contained in:
Kenneth Benzie 2025-08-26 20:40:41 +01:00
parent 8653c8b4cd
commit 62f3061f48

View File

@ -3,6 +3,12 @@ vim.g.loaded_node_provider = 0
vim.g.loaded_perl_provider = 0
vim.g.loaded_ruby_provider = 0
if vim.env.TMUX ~= nil and vim.env.WAYLAND_DISPLAY ~= nil then
-- Use tmux instead of wl-clipboard on Wayland to avoid annoying notification
-- popups when copying/pasting from the system clipboard.
vim.g.clipboard = "tmux"
end
-- Keep cursor from buffer edges
vim.opt.sidescrolloff = 5