mikavilpas / yazi.nvim

A Neovim Plugin for the yazi terminal file manager
MIT License
426 stars 13 forks source link

Use neovim syntax highlighting in the yazi preview panel #411

Closed janbuchar closed 2 weeks ago

janbuchar commented 2 weeks ago

Hi, thanks for the plugin! It would be nice if the syntax highlighting in the yazi preview could be consistent with the rest of neovim. For instance, https://github.com/ibhagwan/fzf-lua does this as well.

mikavilpas commented 2 weeks ago

Hi, glad you're enjoying it! I use it all the time in my own work and like it too.

I think the simplest way you can achieve this with yazi is to use a yazi flavor, which sets up yazi colors as well as code highlighting colors for you. Here are some resources:

mikavilpas commented 2 weeks ago

As far as supporting the generation of these color schemes automatically, right now it's very difficult to do because yazi does not support dynamic configuration the same way as (I think) fzf-lua does it. Yazi also needs to be usable outside of neovim because it's an entirely different application with its own performance optimizations.

Right now I don't see a good way of doing this.

janbuchar commented 2 weeks ago

I think I got pretty close by just using the same colorscheme for yazi. However, I use a treesitter enabled theme in neovim, and LSP also changes symbol colors in some cases. So I'm afraid there's no other way to have the same highlighting in neovim and yazi other than directly using neovim as the previewer.

I believe that fzf-lua opens a neovim floating window with the source code in the area where the preview is.

mikavilpas commented 2 weeks ago

Yeah, I have the same thing as you. I use telescope and its preview is identical to what yazi has (as far as I can tell), but as soon as I open the file in neovim, some symbols get a different color - probably due to additional LSP knowledge (or other neovim plugins, etc).

I hope it's not too disruptive on any other themes. On a more positive note, yazi is generally very performant so at least we can feel good about that. 😄

janbuchar commented 2 weeks ago

It's not a big deal at all, but having that extra bit of consistencty would be super nice :slightly_smiling_face: