Skip to content

Commit c9c3ff8

Browse files
committed
fix: opening multiple current neo-tree windows
When opening a new neo-tree window with the `current` position, do not close all other `current` windows. This allows having multiple `current` windows side-by-side on the same tabpage. It was possible before with the following combination (open neo-tree in one buffer, then split it): :e .<CR>:vs This opened two neo-tree windows side-by-side (when `hijack_netrw_behavior` was set to `open_current`). However, when trying to it the other way around (open two buffers side by side, open neo-tree in one of them, then switch to the other buffer and open neo-tree in that one): :vs<CR>:Neotree position=current<CR><C-W>p:Neotree position=current Opening the second neo-tree window closed the first one. With this fix, both combinations lead to the same result of having two independent neo-tree windows side-by-side with the `current` position.
1 parent 8c7e6d3 commit c9c3ff8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lua/neo-tree/command/init.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ do_show_or_focus = function(args, state, force_navigate)
146146
if not window_exists then
147147
-- Clear the space in case another source is already open
148148
local target_position = args.position or state.current_position or state.window.position
149-
manager.close_all(target_position)
149+
if target_position ~= "current" then
150+
manager.close_all(target_position)
151+
end
150152
end
151153
end
152154

0 commit comments

Comments
 (0)