diff --git a/lua/lib/lib.lua b/lua/lib/lib.lua index 118e9c37..9fd095d9 100644 --- a/lua/lib/lib.lua +++ b/lua/lib/lib.lua @@ -287,6 +287,10 @@ function M.win_open() return M.Tree.winnr() ~= nil end +function M.win_focus() + api.nvim_set_current_win(M.Tree.winnr()) +end + function M.toggle_ignored() pops.show_ignored = not pops.show_ignored return M.refresh_tree() diff --git a/lua/tree.lua b/lua/tree.lua index ddc60e81..9dd1cd25 100644 --- a/lua/tree.lua +++ b/lua/tree.lua @@ -116,6 +116,7 @@ function M.find_file(with_open) if with_open then M.open() + lib.win_focus() end lib.set_index_and_redraw(bufname) end