From ac29090179e019ec0638ab236ca870edd0f3b364 Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Thu, 17 Mar 2022 16:59:53 +0530 Subject: [PATCH] nvim: init: Fix copy and paste with clipboard when using tmux --- nvim/.config/nvim/init.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index 81fa5e4..07ac756 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -79,6 +79,20 @@ vim.g.matchup_surround_enabled = 1 -- textobj-word-column vim.g.textobj_wordcolumn_no_default_key_mappings = 1 +-- See :help clipboard and https://github.com/neovim/neovim/issues/14545 +vim.g.clipboard = { + name = "tmux", + copy = { + ["+"] = "tmux load-buffer -w -", + ["*"] = "tmux load-buffer -w -" + }, + paste = { + ["+"] = "tmux save-buffer -", + ["*"] = "tmux save-buffer -" + }, + cache_enabled = true +} + -- We do this to prevent the loading of the system fzf.vim plugin. This is -- present at least on Arch/Manjaro vim.api.nvim_command('set rtp-=/usr/share/vim/vimfiles')