mikavilpas / yazi.nvim

A Neovim Plugin for the yazi terminal file manager
MIT License
217 stars 7 forks source link

OSC52 copy support missing #64

Closed LumenYoung closed 2 months ago

LumenYoung commented 2 months ago

Hi mikavilpas,

Thanks for this great integration of Yazi into neovim, this is the best I've used so far. One additional thing comes to my mind is the remote copy function is not enabled in yazi.nvim, which means operations like copy filename in yazi is not working when we were connecting to a remote server, even ocs52 is enabled on my neovim via the plugin. I wonder if you know how to enable such osc52 support? Thanks!

Lumen.

mikavilpas commented 2 months ago

Hi, and thanks for the great idea! I would like to implement it maybe over the weekend (let's see 🙂 )

Do you have a recommendation how I could test this feature out? I have not used it myself in yazi.

LumenYoung commented 2 months ago

You mean manually test it out or setting up the test case?

For the former I think you just need to meet the following criterion 1) a terminal emulator that supports osc52 e.g. kitty 2) use the following osc52 plugin for neovim, which enables osc52 for all versions of neovim 3) start this neovim instance on a remote device over ssh and try to yank text to your clipboard, you will get your text if osc52 does work.

For the latter one I have not yet think of any solution yet, but I would like to do some research on that if you need help.

Additionally, yazi itself has already supported osc52, it just didn't work after being proxy-ed inside neovim's terminal. Also the toggleterm texts can also be yanked into clipboard via osc52 once it has been enabled.

mikavilpas commented 2 months ago

Thanks, that's exactly what I was looking for - just a high level overview of what is going on as I'm not familiar with this feature.

Looks like the yazi implementation is here.

Do you use it with c and then pick one of the options in this menu?

image
mikavilpas commented 2 months ago

An additional request: could you try the following steps to rule out yazi.nvim specifically:

LumenYoung commented 2 months ago

Thanks, that's exactly what I was looking for - just a high level overview of what is going on as I'm not familiar with this feature.

Looks like the yazi implementation is here.

Do you use it with c and then pick one of the options in this menu? image

Yeah, I've being using mainly the c and pick something

LumenYoung commented 2 months ago

An additional request: could you try the following steps to rule out yazi.nvim specifically:

  • ssh to your remote machine
  • open nvim
  • run :terminal to open a terminal inside neovim (not using yazi.nvim)
  • manually start yazi inside that terminal
  • try to copy something
  • verify the clipboard gets set on your local machine

You are right, following the above step can't get the desired terminal output. Maybe another distinction should be noticed: the osc52 works with toggleterm in the visual mode, not in the terminal mode. So maybe that is the reason why tui app's osc52 doesn't work.

mikavilpas commented 2 months ago

There seems to be an extremely simple test case here https://github.com/neovim/neovim/issues/3344

echo -e "\033]52;c;$(base64 <<< hello)\a"

I think you would have to paste that into the remote terminal to test it out.

But it seems to me that this might not be related to this plugin. What do you think?

LumenYoung commented 2 months ago

There seems to be an extremely simple test case here neovim/neovim#3344

echo -e "\033]52;c;$(base64 <<< hello)\a"

I think you would have to paste that into the remote terminal to test it out.

But it seems to me that this might not be related to this plugin. What do you think?

I've tested it out, and turns out that you can't get the hello pasted from within neovim's built terminal, suggesting that the reason behind is neovim's terminal lack osc52 support. In that case I would say this problem is not related to yazi.nvim plugin since it is an upstream problem.

Thanks for the help!

LumenYoung commented 2 months ago

For those who are still interested in the possibility of pasting from remote yazi.nvim, this neovim issue is tracking the osc52 support in terminal buffer of neovim.