goolord / alpha-nvim

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

The "AlphaReady" user autocmd is not run #173

Closed sharpenedblade closed 1 year ago

sharpenedblade commented 1 year ago

Description

Any autocmds for User with the pattern AlphaReady are not run when entering an alpha buffer. The noautcmds option is not set.

Expected Behavior

Autocmds created for AlphaReady are run when opening alpha.

Actual Behavior

The AlphaReady autocmd is not run.

Reproducible Example

Using vimscript instead of lua to make the autocmd does not affect this bug.

vim.api.nvim_create_autocmd("User", {
    pattern = "AlphaReady",
    callback = function()
        print('AlphaReady was run')
    end,
})
goolord commented 1 year ago

217137559-138d45d7-1c04-447a-a821-94825ec1bbb7

this is not reproducible. clone alpha and try again with one of the debug configs https://github.com/goolord/alpha-nvim/blob/main/debug/DEBUG.md and if it works then it's a problem with your config

sharpenedblade commented 1 year ago

I think its related to Lazy.nvim lazy-loading stuff, because once I clone as a native neovim package, it starts working.

sharpenedblade commented 1 year ago

So after some debugging, I realized this is caused by a certain colorscheme plugin, namely Catppuccin. I opened a bug against the colorscheme plugins repo, but I think it also belongs here. The colorscheme does not make any changes to alpha-nvim highlights or config, which is why I reopened this bug.

Reproducible config

-- `minimal.lua` used for reproducible configuration
-- Open with `nvim --clean -u minimal.lua`

local is_windows = vim.fn.has("win32") == 1
local function join(...)
  local sep = is_windows and "\\" or "/"
  return table.concat({ ... }, sep)
end

local root_tmp = is_windows and os.getenv("TEMP") or "/tmp"
local lazypath = join(root_tmp, "nvim", "lazy")

if not vim.loop.fs_stat(lazypath) then
    vim.fn.system({
        "git",
        "clone",
        "--filter=blob:none",
        "https://github.com/folke/lazy.nvim.git",
        "--branch=stable",
        lazypath,
    })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
    { "catppuccin/nvim", name = "catppuccin" },
    -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    { "goolord/alpha-nvim" } 
})

require("catppuccin").setup({
    flavour = "mocha"
})

-- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE

local alpha_config = {
    layout = {},
    opts = {}
}
require("alpha").setup(alpha_config)

vim.api.nvim_create_autocmd("User", {
    pattern = "AlphaReady",
    callback = function()
        print("AlphaReady called")
    end,
})

-- COMMENT this to make the autocmd work
vim.cmd.colorscheme('catppuccin')
goolord commented 1 year ago

if this is some weird interaction with lazy loading i don't consider this a bug with the plugin, fwiw i alos use lazy and i haven't encountered this.

what happens if you add event = "VimEnter", or lazy = false to alpha's pluginspec? i would guess that the magic sauce to make everything work right, (i can check tomorrow if you don't have time)

sharpenedblade commented 1 year ago

if this is some weird interaction with lazy loading i don't consider this a bug with the plugin, fwiw i alos use lazy and i haven't encountered this.

what happens if you add event = "VimEnter", or lazy = false to alpha's pluginspec? i would guess that the magic sauce to make everything work right, (i can check tomorrow if you don't have time)

It isn't affected by lazy loading, it has something to do with the colorscheme plugin (see the new config I posted). The config just uses lazy to bootstrap itself, it happens with packer to.

EDIT: I just checked, my main config doesn't lazy-load alpha either.

goolord commented 1 year ago

https://github.com/catppuccin/nvim/issues/399#issuecomment-1421838557

what revision of neovim are you using? if it's some old, non-release commit maybe you could try updating to HEAD neovim

sharpenedblade commented 1 year ago

The latest brew version, 0.8.3. A system lib might be broken, I will try in a fresh VM. EDIT: luajit was broken, it was causing weird problems, a reinstall fixed this.