diff --git a/lua/nvim-tree/actions/node/open-file.lua b/lua/nvim-tree/actions/node/open-file.lua index a0e8f424603..35ec6b66873 100644 --- a/lua/nvim-tree/actions/node/open-file.lua +++ b/lua/nvim-tree/actions/node/open-file.lua @@ -237,10 +237,11 @@ local function open_in_new_window(filename, mode) return end - -- non-floating windows + -- non-floating, non-nvim-tree windows local win_ids = vim.tbl_filter(function(id) local config = vim.api.nvim_win_get_config(id) - return config and config.relative == "" + local bufnr = vim.api.nvim_win_get_buf(id) + return config and config.relative == "" or utils.is_nvim_tree_buf(bufnr) end, vim.api.nvim_list_wins()) local create_new_window = #win_ids == 1 -- This implies that the nvim-tree window is the only one