nvim-lualine / lualine.nvim

A blazing fast and easy to configure neovim statusline plugin written in pure lua.
MIT License
6.19k stars 466 forks source link

Bug: Theme 'auto' only loads after setting colorscheme #310

Closed SenchoPens closed 3 years ago

SenchoPens commented 3 years ago

Self Checks

How to reproduce the problem

Before running colorscheme ... :lua require'lualine.themes.auto'

Actual behaviour

E5108: Error executing lua ...e-manager/start/lualine-nvim/lua/lualine/themes/auto.lua:32: attempt to index local 'rgb_color_str' (a nil value)

Expected behaviour

Auto module is loaded, or it is made clear in the docs that 'auto' only works after setting colorscheme.

Aditional information

Minimal config to reproduce the issue

Config require('lualine').setup()
SenchoPens commented 3 years ago

I can create a pull request to README.md, if this is issue is reproducable.

shadmansaleh commented 3 years ago

I think this is resolved in #308 can you check ?

SenchoPens commented 3 years ago

Sorry to not respond on time, it is now resolved, thanks! However, the colors it chooses will not adjust to a new theme, so it will be looking like this 2021-08-17+01:56:12

while evaluating colorscheme ... before requiring lua line works fine and produces great colors. Running :lua require'lualine.themes.auto' won't change anything, so a :LualineReload command could come in handy, or just a mention in the docs to colorscheme before setting lualine up.

shadmansaleh commented 3 years ago
require'lualine'.setup()

will reload luaine .

Though I can't understand why you can't set colorscheme before lualine in the first place .

SenchoPens commented 3 years ago

Yeah, I can, but maybe the fact that the colorscheme must be set before lualine might be worth mentioning in the docs, bc otherwise it might be hard to debug the wrong colours. I can make a PR if you agree.

shadmansaleh commented 3 years ago

I feel like

auto is a special theme. It will automaticaly load theme for your colorscheme. If there's no theme available for your colorscheme then it'll it's best to generate one.

in https://github.com/shadmansaleh/lualine.nvim/blob/master/THEMES.md#auto implies you will load your desired colorscheme before lualine

SenchoPens commented 3 years ago

Reasonable, ok, I agree, must have hurried and misunderstood this somehow, thanks