NeoVim – Copying to the System Clipboard in KDE

Decided to teach myself some new tricks (moving to zsh from bash and neovim from vim) as a hobby. My main reason to stick with the basic bash and vim is that this is what is available by default and you can rely on by default in most environments, including those that you are unfamiliar with or have no control over – most of my containers and servers for example, do not get zsh or neovim installed.

However, it is 2025 and I am tired of losing my command history for the thousandth time with bash due to it not able to work with mutliple open tabs in konsole (don’t bother following suggestions on shopt histappend, setting the prompt to append to history etc. – fundamentally, bash doesn’t support updating a single consistent history across multiple open shells and you will sooner than later end up losing your command history). So time for trying out some new tricks on my primary Linux desktop – and so thusly enter zsh and neovim.

In true “get off my lawn” mode, first impressions leave me a bit grumpy about having to install new fonts (admittedly, the experience is nicer after nerd fonts are installed), new tools (now I have to relearn how I do grep, find etc. that’s just great! – again, admittedly, these tools are strictly better than their predecessors).

So while those are just someone used to the old complaining about the new without any valid reasons, one thing that really did drive me crazy within 30 minutes of using neovim (I’m using lazyvim by the way) was the fact that copying from the editor to the system clipboard was impossible. After a bit of rooting around, you need to do the following to enable this IMO basic and critical functionality:

  • Install system clipboard utilities – since I am running wayland, I needed to install wl-clipboard. Without this, your configuration to yank to unnamedplus etc. will do absolutely nothing.
  • Modify your init.lua to add this line: vim.api.nvim_set_option("clipboard", "unnamedplus")
  • Restart your nvim – and now anything you copy in your editor (yank in vim parlance)

Leave a Reply

Your email address will not be published. Required fields are marked *