Closed UnlimitedCookies closed 1 year ago
Might be my bad, but I copied it from here.
Both
let g:lightline.colorscheme = 'gruvbox_material'
and
let g:lightline = { 'colorscheme': 'gruvbox_material' }
are legitimate and should be used in different contexts based on your needs:
colorscheme
key in the global g:lightline
dictionary.
Usually what you want when changing the colorscheme on the fly.g:lightline
dictionary entirely.
Usually what you want in your vimrc.Regardless, they should both work as long as g:lightline
is set before lightline gets initialized. The reason why let g:lightline.colorscheme = 'gruvbox_material'
doesn't work for you is because g:lightline
is not initialized elsewhere in your config.
I agree that the example from the docs assumes a bit too much that people know what they are doing with their statusline, and maybe we should change it to let g:lightline = {'colorscheme' : 'gruvbox_material'}
to make it more approachable for people who are new to Vim, or simply new to lightline.
Thank you for the extensive explanation. I'm not too familiar with Vimscript and probably others might also face the same issue when blindly copying the example config, so I guess others might also benefit.
@UnlimitedCookies the docs are now updated (see commit reference in the closing event). Copy-pasting the example config should now work out of the box.
I have done the following steps before reporting this issue:
Operating system/version
Arch Linux
Terminal emulator/version
alacritty latest
$TERM environment variable
alacritty
Tmux version
No response
Feature matrix
NVIM v0.8.3 Build type: Release LuaJIT 2.1.0-beta3 Compiled by builduser
Features: +acl +iconv +tui See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
Minimal vimrc that can reproduce this bug.
See below.
Steps to reproduce this bug using minimal vimrc
Add this line to your vimrc:
Expected behavior
Working docs
seems to work just fine.
Actual behavior
Docs instruction throw error