nvim: init: Use OSC 52 for copying to system clipboard in SSH session

This commit is contained in:
Sanchayan Maity 2023-11-27 17:53:29 +05:30
parent 1d3169af1e
commit 556afeabcc
Signed by: sanchayanmaity
GPG Key ID: 6F6A0609C12038F3
1 changed files with 28 additions and 13 deletions

View File

@ -69,19 +69,34 @@ vim.g.dispatch_no_maps = 1
vim.g.matchup_matchparen_offscreen = {} vim.g.matchup_matchparen_offscreen = {}
vim.g.matchup_surround_enabled = 1 vim.g.matchup_surround_enabled = 1
-- See :help clipboard and https://github.com/neovim/neovim/issues/14545 if os.getenv("SSH_CONNECTION") then
vim.g.clipboard = { local osc52 = require('vim.ui.clipboard.osc52')
name = "clipboard", vim.g.clipboard = {
copy = { name = 'OSC 52',
["+"] = "wl-copy", copy = {
["*"] = "wl-copy" ['+'] = osc52.copy,
}, ['*'] = osc52.copy,
paste = { },
["+"] = "wl-paste", paste = {
["*"] = "wl-paste" ['+'] = osc52.paste,
}, ['*'] = osc52.paste,
cache_enabled = true },
} }
else
-- See :help clipboard and https://github.com/neovim/neovim/issues/14545
vim.g.clipboard = {
name = "clipboard",
copy = {
["+"] = "wl-copy",
["*"] = "wl-copy"
},
paste = {
["+"] = "wl-paste",
["*"] = "wl-paste"
},
cache_enabled = true
}
end
-- No default mappings for tmux navigator -- No default mappings for tmux navigator
vim.g.tmux_navigator_no_mappings = 1 vim.g.tmux_navigator_no_mappings = 1