fix(open-file): focus file if already opened
This commit is contained in:
@@ -335,14 +335,14 @@ function M.focus_file(path)
|
||||
require("nvim-tree.view").set_cursor { i + 1, 1 }
|
||||
end
|
||||
|
||||
function M.is_in_displayed_buffer(path)
|
||||
function M.get_win_buf_from_path(path)
|
||||
for _, w in pairs(vim.api.nvim_tabpage_list_wins(0)) do
|
||||
local b = vim.api.nvim_win_get_buf(w)
|
||||
if vim.api.nvim_buf_get_name(b) == path then
|
||||
return true
|
||||
return w, b
|
||||
end
|
||||
end
|
||||
return false
|
||||
return nil, nil
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user