sainnhe / everforest

🌲 Comfortable & Pleasant Color Scheme for Vim
MIT License
2.94k stars 131 forks source link

Vim airline shows the wrong color for the unfocused terminal panel in the status bar. #105

Closed talwat closed 2 years ago

talwat commented 2 years ago

I have done the following steps before reporting this issue:

Operating system/version

macOS monterey 12.6.1

Terminal emulator/version

Iterm 3.4.16

$TERM environment variable

xterm-256color

Tmux version

No response

Feature matrix

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Oct 19 2022 18:24:48) macOS version - arm64 Included patches: 1-800 Compiled by Homebrew Huge version without GUI. Features included (+) or not (-): +acl +file_in_path +mouse_urxvt -tag_any_white +arabic +find_in_path +mouse_xterm -tcl +autocmd +float +multi_byte +termguicolors +autochdir +folding +multi_lang +terminal -autoservername -footer -mzscheme +terminfo -balloon_eval +fork() +netbeans_intg +termresponse +balloon_eval_term +gettext +num64 +textobjects -browse -hangul_input +packages +textprop ++builtin_terms +iconv +path_extra +timers +byte_offset +insert_expand +perl +title +channel +ipv6 +persistent_undo -toolbar +cindent +job +popupwin +user_commands -clientserver +jumplist +postscript +vartabs +clipboard +keymap +printer +vertsplit +cmdline_compl +lambda +profile +vim9script +cmdline_hist +langmap -python +viminfo +cmdline_info +libcall +python3 +virtualedit +comments +linebreak +quickfix +visual +conceal +lispindent +reltime +visualextra +cryptv +listcmds +rightleft +vreplace +cscope +localmap +ruby +wildignore +cursorbind +lua +scrollbind +wildmenu +cursorshape +menu +signs +windows +dialog_con +mksession +smartindent +writebackup +diff +modify_fname -sodium -X11 +digraphs +mouse -sound -xfontset -dnd -mouseshape +spell -xim -ebcdic +mouse_dec +startuptime -xpm +emacs_tags -mouse_gpm +statusline -xsmp +eval -mouse_jsbterm -sun_workshop -xterm_clipboard +ex_extra +mouse_netterm +syntax -xterm_save +extra_search +mouse_sgr +tag_binary -farsi -mouse_sysmouse -tag_old_static system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" defaults file: "$VIMRUNTIME/defaults.vim" fall-back for $VIM: "/opt/homebrew/share/vim" Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: clang -L. -fstack-protector-strong -L/opt/homebrew/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/readline/lib -o vim -lm -lncurses -liconv -lintl -framework AppKit -L/opt/homebrew/opt/lua/lib -llua5.4 -mmacosx-version-min=12.6 -fstack-protector-strong -L/opt/homebrew/opt/perl/lib/perl5/5.36/darwin-thread-multi-2level/CORE -lperl -L/opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/config-3.10-darwin -lpython3.10 -framework CoreFoundation -lruby.3.1 -L/opt/homebrew/Cellar/ruby/3.1.2_1/lib

Minimal vimrc that can reproduce this bug.

call plug#begin('~/.vim/plugged')
Plug 'sainnhe/everforest'
Plug 'vim-airline/vim-airline'
call plug#end()

set termguicolors
colorscheme everforest

Steps to reproduce this bug using minimal vimrc

  1. Launch vim
  2. Open terminal with :term
  3. Don't focus on new terminal panel

Expected behavior

The normal background color for the status bar should appear

Actual behavior

Screen Shot 2022-10-27 at 19 21 33

The status bar uses the default (i'm assuming) color for the background and font color.

talwat commented 2 years ago

I'm not entirely sure if this is an everforest bug or a vim airline bug.

antoineco commented 2 years ago

If that's something which is configurable I can propose a tweak. Do you have an example of theme that handles this correctly?

talwat commented 2 years ago

Surprisingly, no. I tried both dracula and gruvbox and both have the same issue. I think i'll open an issue in the Airline repository as i'm not sure it's an issue with everforest.

talwat commented 2 years ago

Okay, I checked the vim airline repository and found this issue. Maybe it can be helpful for solving the issue.

antoineco commented 2 years ago

Ah right, airline_term is the highlight group we need to define.

let g:airline#themes#everforest#palette.terminal.airline_term = "...

Right now we set:

let g:airline#themes#everforest#palette.normal.airline_term = "...
let g:airline#themes#everforest#palette.insert.airline_term = "...
let g:airline#themes#everforest#palette.replace.airline_term = "...
let g:airline#themes#everforest#palette.visual.airline_term = "...
let g:airline#themes#everforest#palette.commandline.airline_term = "...
talwat commented 2 years ago

Let me know if there's a temporary patch I can apply in the meantime while this is getting fixed.

antoineco commented 2 years ago

@talwat you can add the aforementioned setting to autoload/airline/themes/everforest.vim on your local machine and play with the color values based on existing groups.

I don't personally use the embedded terminal so your findings works l would be welcome!

talwat commented 2 years ago

Whenever I tried adding it like this: let g:airline#themes#everforest#palette.terminal.airline_term = [ s:term_fg[0] , s:term_bg[0] , s:term_fg[1] , s:term_bg[1] ] for example, vim airline just says the theme couldn't be resolved.

antoineco commented 2 years ago

Could you be more specific?

talwat commented 2 years ago

It threw: airline: Could not resolve theme "everforest". Themes have been migrated to github.com/vim-airline/vim-airline-themes.

I put it under let g:airline#themes#everforest#palette.normal_modified.airline_c = [ s:normal_mod_fg[0] , s:normal_mod_bg[0] , s:normal_mod_fg[1] , s:normal_mod_bg[1] ], in line 114.

This isn't because of the plugin manager I don't think because when I remove it, everything works. (But the bug is still present, obviously)

I highly doubt I will be able to fix this on my own, I have no experience in vimscript/vim theming and am very bad at it.

antoineco commented 2 years ago

I'm surprised about the message Could not resolve theme "everforest". If it cannot resolve the theme, it's unlikely to be related to your change.

I'll install vim-plug and try to reproduce.

talwat commented 2 years ago

Can you make an example fix which works without vim-plug and i'll see if it works or if it's an issue with vim-plug?

antoineco commented 2 years ago

You can remove the plugin from vim-plug, sync vim-plug, then clone this Git repository to ~/.vim/pack/ui/start/everforest.

talwat commented 2 years ago

Same exact error, it's not an issue with vim-plug.

talwat commented 2 years ago

Is this still being fixed?

antoineco commented 2 years ago

Unfortunately I haven't been able to find a solution.

I tried setting g:airline#themes#everforest#palette.normal.airline_term_inactive in the config, but it doesn't seem to have any effect.

The setting g:airline#themes#everforest#palette.terminal.airline_term, which I suggested earlier, is not a valid airline setting.

I believe opening an issue in the airline repo would be appropriate.

talwat commented 2 years ago

I made the issue: https://github.com/vim-airline/vim-airline/issues/2596

chrisbra commented 2 years ago

I think you need to define to make it work:

let g:airline#themes#everforest#palette.inactive_modified.airline_term = [ ... ]
antoineco commented 2 years ago

@chrisbra thanks for the tip, much appreciated 🙌

antoineco commented 2 years ago

@talwat @chrisbra I rejoiced too fast.

I just set g:airline#themes#everforest#palette.inactive_modified.airline_term to some very stupid values as shown below, and the settings didn't apply (I restarted Vim to be sure).

image

talwat commented 2 years ago

I think this might be an internal bug in vim-airline

antoineco commented 2 years ago

@talwat OK, I found it. The correct option to set was g:airline#themes#everforest#palette.inactive.airline_term. inactive_modified doesn't apply to terminal windows, but inactive does.

I just sent a pull request to fix the issue ☝️ It would be nice if you could provide feedback on it!

Thank you for your patience.

talwat commented 2 years ago

Phew, I might even inform a few other theme developers about this issue, thanks!