kevinhwang91 / rnvimr

Make Ranger running in a floating window to communicate with Neovim via RPC
BSD 3-Clause "New" or "Revised" License
800 stars 17 forks source link

support for ueberzugpp #141

Closed dongdongbh closed 1 year ago

dongdongbh commented 1 year ago

ueberzugpp is a command line utility written in C++ which allows to draw images on terminals by using child windows or using sixel on supported terminals. This is a drop-in replacement for the now defunct ueberzug project.

I use it on my ranger, and it works out-of-box. But it do not directly work on rnvimr. Can rnvimr add support for ueberzugpp?

kevinhwang91 commented 1 year ago

Look like doesn't work for me. I am ArchLinux user.

dongdongbh commented 1 year ago

I posted an issue on ueberzugpp, its syntax is a bit different from the original ueberzug. But I use it on plain ranger in cli, it just worked. I use it on Ubuntu 20.04 BTY.

If it's due to the syntax, maybe we can add a configuration option to use a bit different parsing method.

kevinhwang91 commented 1 year ago

After upgrading it, ranger can preview the image, but can't switch images after two previews. It doesn't seem stable enough for me. I leave this issue and will support it if the time is ripe.

dongdongbh commented 1 year ago

OK, it can switch pictrues as many as possible on my computer. Anyway, just wait a bit, seems the maitainer is actively developing.

jstkdng commented 1 year ago

@kevinhwang91 does your terminal support sixel? then perhaps that's the issue. Current ranger doesn't support Ü++'s sixel implementation, I've opened a PR on ranger's side but no luck so far https://github.com/ranger/ranger/pull/2786.

Edit: ranger isn't even trying to start Ü++. weird. Welp, if you need help just open an issue.

kevinhwang91 commented 1 year ago

@jstkdng Sorry, after rebooting my system, it works fine outside nvim terminal, but can't work with ranger inside nvim. Does ueberzugpp use a protocol to communicate with images?

jstkdng commented 1 year ago

U++ can receive commands through stdin (og ueberzug) or tcp (newer). It's weird that ranger in neovim doesn't spawn U++. Is the config being modified?

kevinhwang91 commented 1 year ago

You can reproduce the issue follow below steps:

  1. Start ranger inside nvim: nvim --clean +'term ranger --clean' +'startinsert';
  2. Enable preview image in ranger: set preview_images_method ueberzug and set preview_images true;
  3. Browse images;
jstkdng commented 1 year ago

Yes, I'm able to reproduce the issue. It seems U++ can't correctly find the size in pixels of the neovim terminal. And it's crashing as soon as it is spawned

jstkdng commented 1 year ago

The issue should be fixed on v2.3.0

kevinhwang91 commented 1 year ago

Confirmed. Rnvimr doesn't need to change anything. Please add an installation section for ueberzugpp, so Rnvimr can add docs for the new optional.

jstkdng commented 1 year ago

Hmm, right now the only way to install is to build it from source. There's the AUR package I'm maintaining but I have no package for other distributions. Maybe a flatpak could be built for other distributions but I'm gonna have to do some research.