neovim-session-manager
neovim-session-manager copied to clipboard
Conflict with tanvirtin/vgit.nvim: `The coroutine failed with this message ... Invalid buffer id: 1`
Bug description
I'm not sure which plugin is the guilty here, so I'll open the same issue for both: https://github.com/tanvirtin/vgit.nvim/issues/214
VGit was working well when I was using neovim 0.6.1
version but when I updated to 0.7.0
I start getting this issue only when I use Shatur/neovim-session-manager with VGit. for simplicity and make sure that I am right, I've used ~/.config/nvim/simple-init.vim
:
How to start Neovim with simple configuration file:
nvim -u ~/.config/nvim/simple-init.vim
The simple configuration:
let g:plug_home = '~/.config/nvim/plugins'
call plug#begin(plug_home)
Plug 'nvim-lua/plenary.nvim'
Plug 'tanvirtin/vgit.nvim'
Plug 'Shatur/neovim-session-manager'
call plug#end()
lua << EOF
require('vgit').setup()
EOF
The error message:
Error executing vim.schedule lua callback: ...ig/nvim/plugins/plenary.nvim/lua/plenary/async/async.lua:14: The coroutine failed
with this message: .../nvim/plugins/vgit.nvim/lua/vgit/features/LiveGutter.lua:30: Invalid buffer id: 1
stack traceback:
[C]: in function 'error'
...ig/nvim/plugins/plenary.nvim/lua/plenary/async/async.lua:14: in function 'callback_or_next'
...ig/nvim/plugins/plenary.nvim/lua/plenary/async/async.lua:40: in function <...ig/nvim/plugins/plenary.nvim/lua/plenar
y/async/async.lua:39>
Environment
I think that the issue is on VGit side. When I loading session, I remove all old buffers and VGit should be able to restore its state after buffers cleanup. Here is the code which is responsible for it:
https://github.com/Shatur/neovim-session-manager/blob/f0b0501ed4c311adc24fa00f27f17694faeb36a9/lua/session_manager/utils.lua#L51-L58
I had a similar issue with nvim-scroll: https://github.com/dstein64/nvim-scrollview/issues/70
@MuhammadSawalhy:
You can use my plugin as a temporary fix: https://github.com/nyngwang/NeoNoName.lua. Add this to your config file:
vim.cmd([[
augroup VGitFix
au!
au VimEnter * NeoNoNameClean
augroup END
]])
I design NeoNoNameClean
as a function to remove all redundant [No Name]
-buffers. After running this command you will have only one (valid, listed) [No Name]
. I don't pretty sure why this can fix the problem, but it just works :)
@MuhammadSawalhy: FYI: the method in my previous comment doesn't work now :(
This issue doesn't happen anymore. I think somewhere the bug was fixed in NeoVim or either of the plugins.