Suddenly, after a Vim update, I guess, when I run :colo some_color_scheme, the coloring of my lightline status bar is black and white, as you can see in the following screencast:


Since I version my vimrc, I've made sure that the issue happens even if I revert to a very old version of my vimrc, where I'm sure that :colo was fine, becasue I often use :so ~/.vimrc and it has always been fine.

Anyone can reproduce it?

This is the minimal vimrc I need to reproduce it (well, not quite minimal, as I have vim-plug stuff in it, but ...)

if empty(glob('~/.vim/autoload/plug.vim'))
  silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
call plug#begin('~/.vim/plugged')
Plug 'junegunn/vim-plug'
Plug 'itchyny/lightline.vim'
call plug#end()
set laststatus=2

This is my version of Vim:

$ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 17 2020 21:54:53)
Included patches: 1-1704
Compiled by Arch Linux
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               -farsi             +mouse_sgr         +tag_binary
+arabic            +file_in_path      -mouse_sysmouse    -tag_old_static
+autocmd           +find_in_path      +mouse_urxvt       -tag_any_white
+autochdir         +float             +mouse_xterm       +tcl/dyn
-autoservername    +folding           +multi_byte        +termguicolors
+balloon_eval      -footer            +multi_lang        +terminal
+balloon_eval_term +fork()            -mzscheme          +terminfo
+browse            +gettext           +netbeans_intg     +termresponse
++builtin_terms    -hangul_input      +num64             +textobjects
+byte_offset       +iconv             +packages          +textprop
+channel           +insert_expand     +path_extra        +timers
+cindent           +ipv6              +perl/dyn          +title
+clientserver      +job               +persistent_undo   +toolbar
+clipboard         +jumplist          +popupwin          +user_commands
+cmdline_compl     +keymap            +postscript        +vartabs
+cmdline_hist      +lambda            +printer           +vertsplit
+cmdline_info      +langmap           +profile           +virtualedit
+comments          +libcall           +python/dyn        +visual
+conceal           +linebreak         +python3/dyn       +visualextra
+cryptv            +lispindent        +quickfix          +viminfo
+cscope            +listcmds          +reltime           +vreplace
+cursorbind        +localmap          +rightleft         +wildignore
+cursorshape       +lua/dyn           +ruby/dyn          +wildmenu
+dialog_con_gui    +menu              +scrollbind        +windows
+diff              +mksession         +signs             +writebackup
+digraphs          +modify_fname      +smartindent       +X11
+dnd               +mouse             +sound             -xfontset
-ebcdic            +mouseshape        +spell             +xim
+emacs_tags        +mouse_dec         +startuptime       -xpm
+eval              +mouse_gpm         +statusline        +xsmp_interact
+ex_extra          -mouse_jsbterm     -sun_workshop      +xterm_clipboard
+extra_search      +mouse_netterm     +syntax            -xterm_save
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread    -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -D_REENTRANT  -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.32/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0  -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lelf    -lcanberra  -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.32/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/5.32/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm
  • 2
    How recent is your vim? Latest has patches that might affect it. – Maxim Kim Sep 24 at 16:41
  • @MaximKim, updated. – Enrico Sep 24 at 17:08
  • 1
    just a note on visible part of your vimrc, your hi commands would not survive colorscheme changes. Usually colorscheme tuning is done in ColorScheme autocommand. Do you have hi commands that tune your lightline? – Maxim Kim Sep 24 at 18:34
  • I can reproduce it with :colo blue and again :colo blue – Maxim Kim Sep 24 at 19:01
  • And it is restored once you get into insert mode and back. – Maxim Kim Sep 24 at 19:12

I suspect https://github.com/vim/vim/pull/6970 and related https://github.com/vim/vim/issues/4405

Basically, before the patch it was impossible to put vim into full "default colors mode" as there were no way to do it -- :hi link survived :hi clear. Also cleared highlight groups were impossible to set with :hi def groupname ....

I guess that lightline relies on pre-patched behaviour when highlight links survived colorscheme change.

PS, has checked lightline source -- looks like it should work as it has autocommand to reapply all colors on colorscheme change...

PPS, have just installed lightline -- it works for me when I change colorschemes (vim 8.2.1728).

PPPS, add following to your vimrc:

augroup lightline_hl | au!
    au Colorscheme * call lightline#disable() | call lightline#enable()
augroup END
| improve this answer | |
  • 1
    Ok, I will try to reduce my vimrc to the minimum so that the issue is still reproducible and add it to the question – Enrico Sep 24 at 18:37
  • @EnricoMariaDeAngelis could you upload your vimrc somewhere to check it? – Maxim Kim Sep 24 at 18:43
  • yeah, read my comment above 🤭. I'll do it ASAP. – Enrico Sep 24 at 18:45
  • 1
  • have just installed vim-airline -- it doesn't have this problem. – Maxim Kim Sep 24 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.