Closed otavioschwanck closed 1 year ago
I can do a full review tomorrow, but try this in the meantime: the nvim_create_autocmd
function has a once
argument to prevent an autocmd from running multiple times. If you just add that will it work? E.g.
vim.api.nvim_create_autocmd('SessionLoadPost', {
callback = function() … end,
once = true, -- ← here
})
Glad you found the cause, by the way. And thanks for opening a pull!
I can do a full review tomorrow, but try this in the meantime: the
nvim_create_autocmd
function has aonce
argument to prevent an autocmd from running multiple times. If you just add that will it work? E.g.vim.api.nvim_create_autocmd('SessionLoadPost', { callback = function() … end, once = true, -- ← here })
if i put once, if someone reloads more than one session in one neovim instance, it will bug, right?
Glad you found the cause, by the way. And thanks for opening a pull!
You're welcome!
if i put once, if someone reloads more than one session in one neovim instance, it will bug, right?
Ah, yeah. You're right.
Thanks again!
Fixes: https://github.com/romgrk/barbar.nvim/issues/364
About the issue:
The SessionLoadPre is called multiple times for some reason. If i quickly load a session (when vim start), the first call will unset the pinned (because state.buffers is already set probably). With this, is prevented to call multiple times so quickly.
This PR Fixes LSP-Zero with session plugins that auto-load session on neovim start.
This is not the best solution but it's work!
cc @Iron-E