-
-
Notifications
You must be signed in to change notification settings - Fork 634
Closed
Labels
Description
Description
When opening nvim-tree in more than one tab, closing nvim-tree's split moves you to the next tab with nvim-tree open (as opposed to leaving you in the same tab as you were before) and subsequently closing nvim-tree in this tab throws a stack trace.
Neovim version
NVIM v0.7.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3Operating system and version
Linux 5.17.3-artix1-1
nvim-tree version
Steps to reproduce
nvim -nu /tmp/nvt-min.lua:NvimTreeOpen:tabnew:NvimTreeOpen- return to the first tab, eg
gt(this is only necessary to reproduce the "closing nvim-tree's window moves you to the next tab with nvim-tree open", as the stack trace is thrown regardless) :NvimTreeClose- at this stage you should have been moved to the second tab:NvimTreeToggleresults in
E5108: Error executing lua ...e/pack/packer/start/nvim-tree.lua/lua/nvim-tree/view.lua:81: Vim:E95: Buffer with this name already exists
stack traceback:
[C]: in function 'nvim_buf_set_name'
...e/pack/packer/start/nvim-tree.lua/lua/nvim-tree/view.lua:81: in function 'create_buffer'
...e/pack/packer/start/nvim-tree.lua/lua/nvim-tree/view.lua:190: in function 'open'
...te/pack/packer/start/nvim-tree.lua/lua/nvim-tree/lib.lua:97: in function 'open_view_and_draw'
...te/pack/packer/start/nvim-tree.lua/lua/nvim-tree/lib.lua:123: in function 'open'
...n/site/pack/packer/start/nvim-tree.lua/lua/nvim-tree.lua:47: in function 'open'
...n/site/pack/packer/start/nvim-tree.lua/lua/nvim-tree.lua:31: in function 'toggle'
[string ":lua"]:1: in main chunk
Also, if in step 7 you try to run :NvimTreeClose instead, nvim-tree's split won't be closed and no error message will be thrown.
Expected behavior
Nvim-tree should close normally when used with multiple tabs.
Actual behavior
Either an error is thrown or nvim-tree isn't closed at all.
Minimal config
vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvt-min/site]]
local package_root = "/tmp/nvt-min/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
require("packer").startup {
{
"wbthomason/packer.nvim",
"kyazdani42/nvim-tree.lua",
"kyazdani42/nvim-web-devicons",
},
config = {
package_root = package_root,
compile_path = install_path .. "/plugin/packer_compiled.lua",
display = { non_interactive = true },
},
}
end
if vim.fn.isdirectory(install_path) == 0 then
print "Installing nvim-tree and dependencies."
vim.fn.system { "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path }
end
load_plugins()
require("packer").sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua setup()]]
vim.opt.termguicolors = true
vim.opt.cursorline = true
_G.setup = function()
require("nvim-tree").setup {}
end