From 44489380a81ffaf5aa8757628dbbc78c8bbecc74 Mon Sep 17 00:00:00 2001 From: kiyan Date: Thu, 17 Feb 2022 16:09:45 +0100 Subject: [PATCH] fix: multiple find-file triggered at the same time duplicates files --- lua/nvim-tree/actions/find-file.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/nvim-tree/actions/find-file.lua b/lua/nvim-tree/actions/find-file.lua index b47edb5e..f2d7571e 100644 --- a/lua/nvim-tree/actions/find-file.lua +++ b/lua/nvim-tree/actions/find-file.lua @@ -15,8 +15,11 @@ local function get_index_offset() end end +local running = {} + function M.fn(fname) - if not TreeExplorer then return end + if running[fname] or not TreeExplorer then return end + running[fname] = true local i = get_index_offset() local tree_altered = false @@ -61,6 +64,7 @@ function M.fn(fname) if index and view.is_visible() then view.set_cursor({index, 0}) end + running[fname] = false end return M