sainnhe / gruvbox-material

Gruvbox with Material Palette
MIT License
1.83k stars 164 forks source link

Confusing instruction to set lightline colorscheme in docs #170

Closed UnlimitedCookies closed 1 year ago

UnlimitedCookies commented 1 year ago

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:

let g:lightline.colorscheme = 'gruvbox_material'

Expected behavior

Working docs

let g:lightline = { 'colorscheme': 'gruvbox_material' }

seems to work just fine.

Actual behavior

Docs instruction throw error

UnlimitedCookies commented 1 year ago

Refer to https://github.com/itchyny/lightline.vim/issues/149

sainnhe commented 1 year ago

https://github.com/sainnhe/gruvbox-material/blob/984d4bb876cccfeada376e86ba5babae59da1cce/doc/gruvbox-material.txt#L173-L179

I actually documented this.

UnlimitedCookies commented 1 year ago

Might be my bad, but I copied it from here.

antoineco commented 1 year ago

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:

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.

UnlimitedCookies commented 1 year ago

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.

antoineco commented 1 year ago

@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.