goolord / alpha-nvim

a lua powered greeter like vim-startify / dashboard-nvim
MIT License
1.78k stars 104 forks source link

'conf' table is nil when running :Alpha (or :AlphaRedraw) #174

Closed ingur closed 1 year ago

ingur commented 1 year ago

After updating Alpha to the latest version (as well as updating NeoVim to 0.8.3), I keep getting this error whenever I run :Alpha:

Error executing Lua callback: /home/ingur/.local/share/nvim/lazy/alpha-nvim/lua/alpha.lua:449: attempt to index local 'conf' (a nil
value)
stack traceback:
        /home/ingur/.local/share/nvim/lazy/alpha-nvim/lua/alpha.lua:449: in function 'enable_alpha'
        /home/ingur/.local/share/nvim/lazy/alpha-nvim/lua/alpha.lua:640: in function 'start'
        /home/ingur/.local/share/nvim/lazy/alpha-nvim/lua/alpha.lua:657: in function </home/ingur/.local/share/nvim/lazy/alpha-nvim/
lua/alpha.lua:656>
Press ENTER or type command to continue

Note: It does work on startup, it only gives the error whenever I'm already editing some code and run :Alpha. Unfortunately, I do not have any time to debug this myself right now. Do you have any ideas?

litoj commented 1 year ago

this is caused by this commit just unsure whether it should be all three sources together or we should use alpha.start() with always providing a config, meaning we have to save our config somewhere else.

mehalter commented 1 year ago

I'm also running into this. @JosefLitos I think maintaining a separate configuration for Alpha in our own config seems like a really bad anti-pattern. I would expect that the plugin saves the relevant state that it needs to to operate as intended. Hopefully this gets fixed soon as I really like this dashboard plugin ❤️

goolord commented 1 year ago

fixed in https://github.com/goolord/alpha-nvim/commit/5150909d4b255b3e27a7b786419ba626a666e697 @mehalter @JosefLitos @ingur really sorry about breaking that command! i should really write tests for alpha, there's a bunch of features that I don't use and it's cumbersome to test them all manually

mehalter commented 1 year ago

@goolord Quick question about the new changes. This is a little unfortunate that the config is no longer stored in the plugin as it removes the ability for users to use the require("alpha").start command themselves. The main use case I have here is that I have lazy loading set up for Alpha and my own VimEnter autocommand that calls require("alpha").start(true) which now requires it to be require("alpha").start(true, config) where I have access to passing in the config. Without the plugin tracking this variable outside of the setup function it is impossible for me to set up this auto command without having my own copy of the config variable stored somewhere in my config. This gets really messy when I'm configuring lazy loading and general management of my configuration. It would be logical I think to have config implied to be the default configuration that I use when running setup if one is not passed in. Does that Make sense?

mehalter commented 1 year ago

@goolord This also could be avoided if you made a user accessible command like :Alpha for something like :AlphaStart that does require("alpha").start(true, config) but I'm not sure if that's a good idea when most users won't want/need access to this functionality

goolord commented 1 year ago

it's exported because i want the user to have access to that functionality; i think i'm mildly +1 on saving a config to default to. i'll get around to it. in the meantime you can pin alpha to 21a0f2520ad3a7c32c0822f943368dc063a569fb to get the old behavior

mehalter commented 1 year ago

Awesome! Thanks so much for the quick response. I will leave it pinned to the old commit for now. Would you mind if I opened a new issue to track this? Just so I can get a notification when it is implemented? Just asking because I don't want to end up bogging you down with unwanted open issues on the repo

goolord commented 1 year ago

ya just open an issue