Skip to content

Conversation

@ishay320
Copy link

@ishay320 ishay320 commented Oct 26, 2025

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. neovim/neovim#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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant