Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zellij Clipboard Functionality: Limitations for Integrating Neovim Registers #2637

Open
d0u9 opened this issue Jul 20, 2023 · 11 comments
Open

Comments

@d0u9
Copy link

d0u9 commented Jul 20, 2023

I am a user of Neovim and heavily use its registers. It is convenient to press y to copy some text from Neovim running on the remote host in Zellij to my local laptop's system clipboard.

When I used tmux, it had integrated tmux set-buffer and tmux save-buffer functions that allowed me to pipe their contents into tmux's clipboard. Then, tmux copies these contents to my local clipboard using osc52. Neovim integrated with tmux's clipboard by default, and you can find more information about it by running :help clipboard in nvim.

However, after switching to Zellij, the advanced terminal multiplexer, I discovered that it doesn't have tools like zellij action copy and zellij action paste, which means that Neovim cannot dump its registers' content to the clipboard.

I am wondering if this is a limitation of Zellij's clipboard functionality or if I have some misunderstanding about how it works.

@imsnif
Copy link
Member

imsnif commented Jul 20, 2023

Hey - so, Zellij intentionally does not manage a clipboard. We might add this functionality to plugins in the future.

But I'm wondering - seems to me like the multiplexer in this case is a bit of an extraneous hop, no? Why not have nvim send the OSC52 signal directly? Zellij will pick this up, send it to your terminal and it'll get to your clipboard. No need to go the extra step... or am I missing something?

@d0u9
Copy link
Author

d0u9 commented Jul 20, 2023

It seems that due to nvim's design philosophy, here is an excerpt from nvim's help:

Nvim has no direct connection to the system clipboard. Instead it depends on
a provider which transparently uses shell commands to communicate with the
system clipboard or any other clipboard "backend".

@imsnif
Copy link
Member

imsnif commented Jul 20, 2023

I get the nvim philosophy - ours is similar :)

How about using something like https://github.com/ojroques/nvim-osc52 then?

@d0u9
Copy link
Author

d0u9 commented Jul 21, 2023

Sounds interesting. will try it. Thank you.

@hardfau1t
Copy link

hardfau1t commented Oct 19, 2023

there is also osc52 tool which can be used to copy from remote, but it works only outside of zellij, Not sure whats going on here(Honestly i just heard about osc52😛)

EDIT: my bad, it doesn't work with tmux, screen

@hardfau1t
Copy link

I get the nvim philosophy - ours is similar :)

How about using something like https://github.com/ojroques/nvim-osc52 then?

this works, just make sure to comment out copy_command and copy_clipboard in remote zellij config

@andrius
Copy link

andrius commented Apr 2, 2024

Neovim v10 release is soon and it have a build-in OSC52 integration currently. However it does not work with zellij (tmux user here). Nvim's :checkhealth command does not find a clipboard provider.

I use mosh/ssh and literally live in the remote session, have nothing installed on my laptop

@justinvson-pd
Copy link

I'm having the same issue, and when I manually add osc-52 as clipboard provider, it will copy just fine but when pasting it will time out, with "Waiting for OSC 52 response from the terminal. Press Ctrl-C to interrupt...". Using kitty to ssh to remote server where I have nvim locally installed, zellij as well

@andrius
Copy link

andrius commented Apr 11, 2024

I'm having the same issue, and when I manually add osc-52 as clipboard provider, it will copy just fine but when pasting it will time out, with "Waiting for OSC 52 response from the terminal. Press Ctrl-C to interrupt...". Using kitty to ssh to remote server where I have nvim locally installed, zellij as well

@justinvson-pd if you have resolved the issue (I use both foot and Kitty), could you share your config?

@justinvson-pd
Copy link

I'm having the same issue, and when I manually add osc-52 as clipboard provider, it will copy just fine but when pasting it will time out, with "Waiting for OSC 52 response from the terminal. Press Ctrl-C to interrupt...". Using kitty to ssh to remote server where I have nvim locally installed, zellij as well

@justinvson-pd if you have resolved the issue (I use both foot and Kitty), could you share your config?

I am currently using "just use CTRL-SHIFT-V as paste" as a workaround. Paste from nvim buffer still times out.

@whmountains
Copy link

I think there are two problems here:

  1. Neovim does not detect OSC52 support when inside Zellij (not sure why)
  2. It is not possible to paste using OSC52 while inside Zellij. (reported using foot, kitty and iTerm2 emulators)

For the first problem, it's unclear whether Neovim or Zellij is at fault. At any rate there is a pretty easy workaround to force Neovim to use OSC52. That workaround is documented under :h clipboard-osc52.

The second problem is almost certainly an issue with Zellij since it has been documented with multiple terminal emulators. I can even reproduce it without Neovim at all, using theimpostor/osc or rumpelsepp/oscclip.

It appears that while Zellij added support for passing through OSC52 copy events in #1644, support for paste events was never added. In fact, @theimpostor already opened #2647 about this.

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

No branches or pull requests

6 participants