feat: Add command to focus tree window regardless of window state (#250)
This commit is contained in:
@@ -366,13 +366,15 @@ function M.win_open()
|
|||||||
return M.Tree.winnr() ~= nil
|
return M.Tree.winnr() ~= nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.win_focus(winnr)
|
function M.win_focus(winnr, open_if_closed)
|
||||||
local wnr = winnr or M.Tree.winnr()
|
local wnr = winnr or M.Tree.winnr()
|
||||||
|
|
||||||
if vim.api.nvim_win_get_tabpage(wnr) ~= vim.api.nvim_win_get_tabpage(0) then
|
if vim.api.nvim_win_get_tabpage(wnr) ~= vim.api.nvim_win_get_tabpage(0) then
|
||||||
M.close()
|
M.close()
|
||||||
M.open()
|
M.open()
|
||||||
wnr = M.Tree.winnr()
|
wnr = M.Tree.winnr()
|
||||||
|
elseif open_if_closed and not M.win_open() then
|
||||||
|
M.open()
|
||||||
end
|
end
|
||||||
|
|
||||||
api.nvim_set_current_win(wnr)
|
api.nvim_set_current_win(wnr)
|
||||||
|
|||||||
Reference in New Issue
Block a user