Skip to content

Empty buffer when opening project root directory #756

Closed
@zhengpd

Description

@zhengpd

Neovim shows an empty buffer when I open the project root directory from current buffer with edit . . A quick debug gave me a workaround to make the dir content show up:

diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua
index 89a591f..d4160b2 100644
--- a/lua/nvim-tree.lua
+++ b/lua/nvim-tree.lua
@@ -301,7 +301,7 @@ function M.open_on_directory()
   end
   local buf = api.nvim_get_current_buf()
   local bufname = api.nvim_buf_get_name(buf)
-  if vim.fn.isdirectory(bufname) ~= 1 or bufname == lib.Tree.cwd then
+  if vim.fn.isdirectory(bufname) ~= 1 then
     return
   end

Don't know if it's the correct way to fix the problem though.

Here's my config:

require'nvim-tree'.setup {
  hijack_cursor = false, -- put cursor at start of filename
  update_cwd = true,
  update_focused_file = {
    enable = true,
    update_cwd = true
  },
  view = {
    auto_resize = true
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions