mikavilpas / yazi.nvim

A Neovim Plugin for the yazi terminal file manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Don't show image preview when open inside neovim

minhtien3297 opened this issue Β· comments

When opened inside neovim, the image preview just doesn't work

Screenshot 2024-06-12 at 3 52 49β€―PM

This is when open outside of neovim

Screenshot 2024-06-12 at 3 51 42β€―PM

I have this issue myself. I looked into it a while ago and I think this is not supported in neovim's embedded terminal yet.

I don't know if this can be resolved until support is added. Let's keep this open to track the status as well as any additional findings and ideas.

Ok, nice find - that was fast πŸ˜„ ! I think that might work nicely, but one issue remains: in neovim, we don't yet know
what is being previewed in yazi.

This is actually a neovim specific limitation and can be worked around with e.g. my proposal at
sxyazi/yazi#1004, which would add the ability to read events from the embedded yazi process in
real time. Currently we can only read them after yazi has closed.

So it would work like this:

sequenceDiagram
  neovim->>yazi: open yazi
  yazi->>neovim: file hovered event: /path/to/image.png
  neovim-->neovim: preview image
  yazi->>neovim: file hovered event: /path/to/file.txt
  neovim-->neovim: πŸ”Ž not an image, don't preview anything
Loading

I also wonder if this would work if yazi were configured to use https://github.com/jstkdng/ueberzugpp with yazi. I haven't tried this out, so it might be subject to the same neovim terminal limitation which causes images not to show.

we don't yet know what is being previewed in yazi.

we can check the filetype? restrict the config to jpg, png, ...

The issue is not yet knowing the name of the file that is hovered in yazi.

I also wonder if this would work if yazi were configured to use https://github.com/jstkdng/ueberzugpp with yazi. I haven't tried this out, so it might be subject to the same neovim terminal limitation which causes images not to show.

https://yazi-rs.github.io/docs/configuration/yazi/#preview.ueberzug_scale

Want to do an experiment with yazi + ueberzugpp + yazi.nvim to see if it works with this configuration? πŸ™‚

Want to do an experiment with yazi + ueberzugpp + yazi.nvim to see if it works with this configuration? πŸ™‚

wait what? it already works there's no need for anything to be done πŸ™ƒ, i havent updated, i dont use image.nvim

Important

we have to pass something to the main config of yazi for the ueberzug offset (~/.config/yazi/yazi.toml)

[preview]
ueberzug_offset = [7.5,1,0,0]

Important

this ⬆️ is what i configured for correct display of image, and it might be different for different people, as u might see the below images, the ueberzug offset is messed up ...

opts = {
    floating_window_scaling_factor = 1,
}

image

opts = {
    floating_window_scaling_factor = 0.8,
}

image

direct yazi window:
image

Oh, nice! Excellent work!

Oh, nice! Excellent work!

ok i didnt do anything, my ueberzug wasnt working (i hadnt updated it for a while) :p

Awesome - thanks for the link!