fix(open-file): focus file if already opened

This commit is contained in:
kiyan
2022-07-16 15:38:50 +02:00
parent 89becc7604
commit 4900d66370
3 changed files with 9 additions and 7 deletions

View File

@@ -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