Skip to content

Commit

Permalink
fix(#1629): nvim start with file named *NvimTree* opens tree instead …
Browse files Browse the repository at this point in the history
…of buffer
  • Loading branch information
alex-courtis committed Oct 9, 2022
1 parent 54afa50 commit e713607
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions lua/nvim-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,6 @@ function M.tab_change()
end
end

local function find_existing_windows()
return vim.tbl_filter(function(win)
local buf = api.nvim_win_get_buf(win)
return api.nvim_buf_get_name(buf):match "NvimTree" ~= nil
end, api.nvim_list_wins())
end

local function is_file_readable(fname)
local stat = luv.fs_stat(fname)
return stat and stat.type == "file" and luv.fs_access(fname, "R")
Expand Down Expand Up @@ -258,13 +251,7 @@ function M.on_enter(netrw_disabled)
end
end

-- Session that left a NvimTree Buffer opened, reopen with it
local existing_tree_wins = find_existing_windows()
if existing_tree_wins[1] then
api.nvim_set_current_win(existing_tree_wins[1])
end

if should_open or existing_tree_wins[1] ~= nil then
if should_open then
lib.open(cwd)

if should_focus_other_window then
Expand Down

0 comments on commit e713607

Please sign in to comment.