goolord / alpha-nvim

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

dashboard shifts to left when you open and close nvim-tree #139

Closed Rishabh672003 closed 2 years ago

Rishabh672003 commented 2 years ago

here's video of it happening - https://imgur.com/a/EjfCg7s

and here's my nvim-tree and alpha configs - alpha-dashboard, nvim-tree

goolord commented 2 years ago

my best guess is that something in nvim-tree changes that made the interaction different, it's happened before. i'm gonna see if i can hook into wincmds with the autocmd api so that this doesn't happen again.

goolord commented 2 years ago

well, I can't apparentlly. I'm not sure any of the existing autocmd events will let me do that. it's just some quirk of nvim-tree, toggleterm works fine for me for example

adding this autocmd to your setup function should hotfix the behavior

            vim.api.nvim_create_autocmd({ 'CursorMoved' }, {
              group = vim.api.nvim_create_augroup("alpha_temp", {
                 clear = false
              }),
              pattern = '*',
              callback = function() alpha.redraw(conf, state) end,
            })

truthfully this will probably always behave jankily until https://github.com/neovim/neovim/issues/11532

goolord commented 2 years ago

i pushed a mildly more safe hotfix actually, this should be fixed (to the end user :p) now

goolord commented 2 years ago

https://github.com/goolord/alpha-nvim/commit/f17ded7c848c4200e2bb876095965688211f1502

Rishabh672003 commented 2 years ago

@goolord yeah that seems to fix it, thank you