Closed minhtien3297 closed 2 weeks ago
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.
@mikavilpas buddy check this out: https://new.reddit.com/r/neovim/comments/1dcjuxc/simplyfilenvim_now_can_use_3rdimagenvim_to/
might be able to steal 😉 some code
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 https://github.com/sxyazi/yazi/pull/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
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,
}
opts = {
floating_window_scaling_factor = 0.8,
}
direct yazi window:
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
Regarding Yazi's behavior in Neovim: https://yazi-rs.github.io/docs/image-preview#neovim
Awesome - thanks for the link!
When opened inside neovim, the image preview just doesn't work
This is when open outside of neovim