Skip to content

Tab title left as NvimTree_1 when file opened in new tab #1769

Closed
@sarahkittyy

Description

@sarahkittyy

Description

2022-11-22.17-55-57.mp4

Opening a new file by hitting t leaves NvimTree_X as the tab title.

Currently, I use autocmd BufLeave NvimTree* wincmd l, which moves the cursor from the tree buffer when switching tabs, so that the title changes to the actual buffer I'm working on.

This doesn't work when first hitting t to open the file in a new tab.

How can I make nvimtree not show up in the tab title? It's helpful to be able to see

Neovim version

NVIM v0.8.0-dev-1178-g1d337d4e2
Build type: Release
LuaJIT 2.1.0-beta3

Operating system and version

Linux sarah-pc 5.10.43.3-microsoft-standard-WSL2 #1 SMP Wed Jun 16 23:47:55 UTC 2021 x86_64 GNU/Linux

nvim-tree version

68a2a09

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",
      "nvim-tree/nvim-tree.lua",
      "nvim-tree/nvim-web-devicons",
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    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

-- MODIFY NVIM-TREE SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
_G.setup = function()
  require("nvim-tree").setup {
	view = {
		mappings = {
			list = {
				{ key = "t",                        action = "tabnew" },
			}
		}
	}
  }
end

Steps to reproduce

  1. nvim -nu nvt-min.lua
  2. :NvimTreeOpen
  3. Open one file with <CR>
  4. Open another file with t

Expected behavior

The tab with the first file opened should contain the name of the opened file.

Actual behavior

The tab title contains NvimTree_1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions