let ctrl+c copy work over ssh
This commit is contained in:
@@ -7,3 +7,25 @@ require "nvchad.options"
|
||||
|
||||
vim.g.lua_snippets_path = { vim.fn.stdpath "config" .. "/snippets" }
|
||||
|
||||
-- route "+/* registers through the terminal with OSC 52 when connected over SSH,
|
||||
-- since xclip/wl-copy on the server can't reach the local clipboard.
|
||||
-- paste must be present or the whole provider is rejected, but never query the
|
||||
-- terminal: it generally refuses OSC 52 reads, and clipboard=unnamedplus makes
|
||||
-- every put read "+", which would block on the query timeout. returning 0 makes
|
||||
-- puts fall back to the internal register instantly.
|
||||
if vim.env.SSH_TTY or vim.env.SSH_CONNECTION then
|
||||
-- nvchad sets clipboard=unnamedplus, which syncs every yank/delete to "+;
|
||||
-- over SSH only the explicit "+y from Ctrl+C should hit the terminal
|
||||
vim.o.clipboard = ""
|
||||
|
||||
local osc52 = require "vim.ui.clipboard.osc52"
|
||||
local function no_paste()
|
||||
return 0
|
||||
end
|
||||
vim.g.clipboard = {
|
||||
name = "osc52",
|
||||
copy = { ["+"] = osc52.copy "+", ["*"] = osc52.copy "*" },
|
||||
paste = { ["+"] = no_paste, ["*"] = no_paste },
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user