neovide / neovide

No Nonsense Neovim Client in Rust
https://neovide.dev
MIT License
12.74k stars 515 forks source link

Passing `set termguicolors` command to nvim #287

Closed VladimirMarkelov closed 3 years ago

VladimirMarkelov commented 4 years ago

Hi! Thanks for the application. It looks promising. I found a little annoyance that took some time to investigate. I used neovim-qt and everything was fine. When I switched to neovide, everything worked smoothly except the colors were weird. After digging the issue, I realized that I have to add set termguicolors to init.vim to make colors nice. But why neovim-qt does not need it? Neovim-qt passes --cmd set termguicolors in command line when running nvim.

Could you make neovide to pass the option, so one shouldn't update neovim config to make a colorscheme look the same as in neovim-qt?

j4qfrost commented 4 years ago

I believe this is a problem with selecting the appropriate fallback standards on different systems. Qt usually comes with a bundled default, so if something isn't installed they switch to something that looks appropriate. Please correct me if I'm wrong.

We have brief related discussions here https://github.com/Kethku/neovide/issues/272 and here https://github.com/Kethku/neovide/issues/269

I think the main issue is settling on a standard.

VladimirMarkelov commented 4 years ago

I do not insist on it, but I think GUI application can tell to nvim that it is a GUI one. And neovim-qt does it. Here is the command line neovim-qt launches nvim with:

nvim  --embed --cmd "let &rtp.=',c:/neovim/share/nvim-qt/runtime'" --cmd "set termguicolors" main.rs
VladimirMarkelov commented 4 years ago

I think the main issue is settling on a standard. is a good point. It was the first my thought when I found out why both apps displayed colors in a different way. If it is done to follow standards, feel free to close the issue :)

j4qfrost commented 4 years ago

I can make a pull request later today, but I'm not sure if I can test --cmd "set termguicolors" reliably. If you want to contribute, here is where you would need to add the argument for nvim. https://github.com/Kethku/neovide/blob/dc399c3c49db2861394c7a21f66dae3a44e193f3/src/bridge/mod.rs#L75

I'll leave the issue open for now to see if anyone else runs into this problem. Thanks.

VladimirMarkelov commented 4 years ago

I agree. Let's have it opened for a while. At this moment, I have added the command to my init.vim. It breaks neither neovim-qt nor neovide. So, I have a working solution and I am fine. It can be an issue for another person who get the same trouble(or instead of an issue it can be added to FAQ? I am not sure about it). For some color schemes it is not clear that termguicolors is unset(e.g, gruvbox looks good without it), but I was "lucky" to use a color scheme that was not designed for terminal colors(gruvbox-material) and had to fix it.

Kethku commented 4 years ago

I do recall this being a thing a while back and the conclusion was that neovim-qt does it by default but other guis do not. I'm not apposed to forcing it to be set because I'm not aware of any repercussions... A PR to do this would be greatly appreciated, but I will get to it eventually.

SirJson commented 4 years ago

This might be a stupid question but why is termguicolors good or bad for neovide?

Receiving 24-bit color data (if that happens) should almost always result in better rendering. I'm surprised that it makes a difference at all to clients using the RPC API. The only reason why it might be bad is because termguicolors reacts to your $TERM variable, but this should not matter for a Neovim Client that draws everything with Skia

j4qfrost commented 4 years ago

I tried adding --cmd "set termguicolors" on my Mac and it doesn't pass the unit tests. Not sure what the behavior is, so I'll leave this to someone else.