fix(#1629): nvim start with file named *NvimTree* opens tree instead of buffer
This commit is contained in:
@@ -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")
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user