From 6a91c7b2cea26dec690525d16e9ff65f89968f0d Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Thu, 17 Nov 2022 09:18:56 +0200 Subject: [PATCH] Neovim: fix clipboard on wayland --- home/.config/nvim/lua/settings.lua | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/home/.config/nvim/lua/settings.lua b/home/.config/nvim/lua/settings.lua index a166867..df96b51 100644 --- a/home/.config/nvim/lua/settings.lua +++ b/home/.config/nvim/lua/settings.lua @@ -11,7 +11,7 @@ o.guifont = "Fira Code:h14" g.neovide_hide_mouse_when_typing = true -- Enable cursor particles in neovide -g.neovide_cursor_vfx_mode = 'railgun' +g.neovide_cursor_vfx_mode = "railgun" -- Floating window transparency o.winblend = 10 @@ -53,3 +53,22 @@ g.mapleader = " " o.tabstop = 4 o.shiftwidth = 4 o.smartindent = true + +-- Wayland clipboard provider that strips carriage returns (GTK3 issue). +-- This is needed because currently there's an issue where GTK3 applications on +-- Wayland contain carriage returns at the end of the lines (this is a root +-- issue that needs to be fixed). +vim.cmd([[ +let g:clipboard = { + \ 'name': 'wayland-strip-carriage', + \ 'copy': { + \ '+': 'wl-copy --foreground --type text/plain', + \ '*': 'wl-copy --foreground --type text/plain --primary', + \ }, + \ 'paste': { + \ '+': {-> systemlist('wl-paste --no-newline | tr -d "\r"')}, + \ '*': {-> systemlist('wl-paste --no-newline --primary | tr -d "\r"')}, + \ }, + \ 'cache_enabled': 1, + \ } +]])