Skip to content

NvimTree_1 will hijack the window when close the buf #3315

@chenjie199234

Description

@chenjie199234

Description

  1. OpenDir
Image
  1. OpenFile
Image
  1. :lua vim.lsp.buf.definition() on fmt.Println
    the buf changed to print.go,the scan.go buf is because of the lsp's diagnostic
    if without this,close the opened file main.go directly,everything works fine
Image
  1. :bw
    close the current buf
    here is the problem!
    the NvimTree_1 hijack the window
    we can see the main.go in the buf list,there has no prefix path,so the current buf already changed to the main.go
Image
  1. :bn
    change to next buf
Image

Neovim version

NVIM v0.12.1
Build type: Release
LuaJIT 2.1.1774638290

Operating system and version

windows 11 amd64

Windows variant

windows terminal app with powershell

nvim-tree version

"nvim-tree.lua": { "branch": "master", "commit": "509962f21ab7289d8dcd28568af539be39a8c01e" }

Clean room replication

require('lazy').setup({
  {
    'kyazdani42/nvim-tree.lua',
    opts={
      on_attach=function(bufnr)
        local api = require('nvim-tree.api')
        api.config.mappings.default_on_attach(bufnr)
        vim.keymap.del('n','f',{ buffer = bufnr })
        vim.keymap.del('n','F',{ buffer = bufnr })
        vim.keymap.del('n','q',{ buffer = bufnr })
        vim.keymap.set('n','f',api.tree.toggle)
        vim.keymap.set('n','F',api.tree.toggle)
        -- <C-_> is <C-/>
        vim.keymap.set('n','<C-_>',function()api.tree.open();api.live_filter.start();end)
        vim.keymap.set('n','<M-/>',function()api.tree.open();api.live_filter.start();end)
        vim.keymap.set('n','?',api.tree.toggle_help)
      end,
      disable_netrw=true,
      hijack_netrw=true,
      hijack_unnamed_buffer_when_opening=true,
      prefer_startup_root=true,
      sync_root_with_cwd=true,
      reload_on_bufenter=true,
      respect_buf_cwd=true,
      update_focused_file = {
        enable = true,
        update_root = {
          enable = true,
          ignore_list = {},
        },
        exclude = false,
      },
      diagnostics = {
        enable = true,
        show_on_dirs = false,
        show_on_open_dirs = true,
        icons = {
          hint = "H",
          info = "I",
          warning = "W",
          error = "E",
        },
      },
    },
    lazy=false,
  },
})

Steps to reproduce

see the Description

Expected behavior

when close the buf created by lsp's definition,the NvimTree_1 will not hijack the window

Actual behavior

when close the buf created by lsp's definition,the NvimTree_1 will hijack the window
see the step 4

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS Windows PowerShellspecific to windows powershellbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions