vifm / vifm.vim

Vim plugin that allows use of vifm as a file picker
325 stars 18 forks source link

How to set a separate theme for Vifm.vim? #72

Closed mohabmetwalli closed 2 years ago

mohabmetwalli commented 2 years ago

Even without using :VifmCs, when launched through the plugin's commands, Vifm.vim always uses Vim's theme, or an approximation thereof, and Vifm's native :colorscheme command doesn't have any effect.

Can this behavior be disabled/altered so I can set a separate theme for Vifm.vim?

xaizek commented 2 years ago

Vifm.vim always uses Vim's theme

It can't, it probably just looks like it.

Please provide terminal information from the bottom of :vifm menu when Vifm is launched inside Vim, it might be helpful. I suspect $TERM value gets set to something that supports only 16 colors, this is especially likely when using gVim.

mohabmetwalli commented 2 years ago

Please provide terminal information from the bottom of :vifm menu when Vifm is launched inside Vim, it might be helpful.

2021-12-15-022321_400x177_scrot

echo $TERM from inside Vifm.vim returns xterm-256color too. I'm using terminal-based Neovim, and xfce4-terminal.

mohabmetwalli commented 2 years ago

https://user-images.githubusercontent.com/96145196/146198979-9b47dee4-bdc6-4ca2-8a0e-51e6b4b35422.mp4

This is how the plugin behaves; I think only the background color tries to match that from Vim's current color scheme.

In addition to that, :colorscheme does not work inside Vifm.vim. It doesn't throw an error, but it doesn't have any effect.

xaizek commented 2 years ago

Oh, that's just "default" colors. Terminal has one for background and foreground and programs can use them to match terminal's theme, builtin terminals have them too. You can modify Vifm's color scheme to not have "default", "-1" or "None" for colors to get rid of this effect.

:colorscheme should work though unless Neovim's terminal is doing something with the palette. Vifm just uses colors as they are specified in the color scheme and terminal information looks correct. Having

highlight Win   ctermbg=default

in colorschemes is quite common, so I wouldn't be surprised if it's responsible for an impression that colorscheme isn't changed.

mohabmetwalli commented 2 years ago

Thank you for the helpful information, I think :colorscheme worked all along, but the background color matching Neovim's color scheme change is what confused me. I'm beginning to figure it out, but shouldn't both Vifm.vim and Vifm show the same color if I'm using the same color scheme?

This is Vifm.vim, launched from inside Neovim with :TabVifm command, and displaying the output of :colorscheme? at the bottom: 2021-12-15-170344_1364x766_scrot

This is Vifm launched directly from xfce4-terminal: 2021-12-15-170358_1364x766_scrot

Some options seem to be defaulting to terminal colors in Vifm.vim, but not in Vifm even though I'm using the same color scheme for both. They're both loading form the same file, essentially, but displaying different results.

xaizek commented 2 years ago

Things like nmap, vmap highlighted in red suggest that Neovim applies syntax rules to the terminal buffer, see if 'syntax' is set for it. I think Vim automatically disables things that make no sense in terminal buffers, but Neovim might need to have them disabled explicitly.

mohabmetwalli commented 2 years ago

I tried :syntax clear, :syntax off, and :ownsyntax off, but the problem presists; however, :set nospell did the trick.

I tried :syntax spell notoplevel but it wasn't enough to disable highlighting spelling errors inside Vifm.vim; however, I can do something like :setlocal nospell | :Vifm to get Vifm.vim to launch with a clean color scheme, and :tabnew | :setlocal nospell | :Vifm as an alternative to :TabVifm.

It seems the behavior is tied to Neovim spell-checking comments, so as long as that is enabled, it will continue to check :Vifm output for spelling mistakes whenever it's launched with any of the plugin's commands. Unless there's a Neovim option I missed that can disable spell-checking/highlighting spelling mistakes in this particular scenario...

Thank you for your help. If there's nothing else that can be done, I think I'm satisifed with this solution for the most part, so I will close this issue tomorrow.

xaizek commented 2 years ago

Spelling, of course, should have guessed by the curly line. Thanks, I've added setlocal nospell, which seems to fix it.