remote-nvim.nvim icon indicating copy to clipboard operation
remote-nvim.nvim copied to clipboard

implemented workaround for nvim copy via OSC52

Open ishay320 opened this issue 2 months ago • 0 comments

When using Neovim in a remote session, OSC52 clipboard sequences are being printed to the local terminal instead of being routed to the remote terminal. This breaks clipboard synchronization for remote users. https://github.com/neovim/neovim/issues/28792

that is a workaround to the problem in #146 that on the remote-nvim side that is connected to ssh it will parse the osc52 and pass it to clipborad.

In config need to add something like:

if os.getenv("SSH_CLIENT") ~= nil then
	local function noop()
		return {}
	end
	vim.g.clipboard = {
		name = "OSC 52",
		copy = {
			["+"] = require("vim.ui.clipboard.osc52").copy("+"),
			["*"] = require("vim.ui.clipboard.osc52").copy("*"),
		},
		-- NOTE: OSC 52 paste is a security risk, so most terminals disable it
		paste = {
			["+"] = noop,
			["*"] = noop,
		},
	}
end

ishay320 avatar Oct 26 '25 07:10 ishay320