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

@OliverGuy
Copy link

OliverGuy commented Dec 5, 2025

Hey there, I've tested your fork and OSC 52 copying still does not work over SSH on my setup.
Would you mind sharing the relevant parts of your config and test setup ?
Are you testing this over SSH ? What's your terminal emulator ?

@ishay320
Copy link
Author

ishay320 commented Dec 7, 2025

I'm using ghostty for the terminal that opens the connection, and I checking over ssh.
To check if the OSC52 works for you, ssh normally to the server, open nvim with the config above and try to copy to the + register, if it works then it should work.
Also when you use the plugin to remote, keep the status of the connection open because it stdout all the stuff from the remote, and you would see the print of the copy there.

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.

2 participants