Skip to content

Commit e713607

Browse files
committed
fix(#1629): nvim start with file named *NvimTree* opens tree instead of buffer
1 parent 54afa50 commit e713607

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

lua/nvim-tree.lua

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,6 @@ function M.tab_change()
133133
end
134134
end
135135

136-
local function find_existing_windows()
137-
return vim.tbl_filter(function(win)
138-
local buf = api.nvim_win_get_buf(win)
139-
return api.nvim_buf_get_name(buf):match "NvimTree" ~= nil
140-
end, api.nvim_list_wins())
141-
end
142-
143136
local function is_file_readable(fname)
144137
local stat = luv.fs_stat(fname)
145138
return stat and stat.type == "file" and luv.fs_access(fname, "R")
@@ -258,13 +251,7 @@ function M.on_enter(netrw_disabled)
258251
end
259252
end
260253

261-
-- Session that left a NvimTree Buffer opened, reopen with it
262-
local existing_tree_wins = find_existing_windows()
263-
if existing_tree_wins[1] then
264-
api.nvim_set_current_win(existing_tree_wins[1])
265-
end
266-
267-
if should_open or existing_tree_wins[1] ~= nil then
254+
if should_open then
268255
lib.open(cwd)
269256

270257
if should_focus_other_window then

0 commit comments

Comments
 (0)