Skip to content
Xeron
Go back

Neovim Clipboard on Wayland

Published:
Suggest Changes

You d-delete a block in Neovim, then try to paste what you yanked earlier — but what comes out is what you just deleted.

At first I thought Neovim wasn’t talking to wl-clipboard:

vim.opt.clipboard = "unnamedplus"

That wasn’t it. unnamedplus syncs every d to the system clipboard, so the delete overwrites what you had yanked.

Vim’s logic is: delete is cut — deleted text goes to a register by default. To make d delete without yanking, route it to the black-hole register _ in ~/.config/nvim/init.lua:

vim.api.nvim_set_keymap('n', 'd', '"_d', { noremap = true })
vim.api.nvim_set_keymap('n', 'D', '"_D', { noremap = true })
vim.api.nvim_set_keymap('n', 'dd', '"_dd', { noremap = true })

Suggest Changes
Share this post on:

Previous Post
Notes on Crypto Trading
Next Post
Python OCR Automation on Hyprland