Skip to content

Commit 6c6e34e

Browse files
committed
Re-implement global/local override logic
1 parent 70b31f3 commit 6c6e34e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lua/neo-tree/sources/common/commands.lua

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,17 @@ local function get_folder_node(state, node)
2020
if not node then
2121
node = tree:get_node()
2222
end
23-
local use_parent_local = state.config.same_level == "sibling"
24-
local use_parent_global = require("neo-tree").config.window.insert_as == "sibling"
23+
24+
local insert_as_local = state.config.insert_as
25+
local insert_as_global = require("neo-tree").config.window.insert_as
2526
local use_parent
26-
local is_open_dir = node.type == "directory" and (node:is_expanded() or node.empty_expanded)
27-
if not use_parent_global then
28-
use_parent = use_parent_local
27+
if insert_as_local then
28+
use_parent = insert_as_local == "sibling"
2929
else
30-
use_parent = use_parent_local ~= "child"
30+
use_parent = insert_as_global == "sibling"
3131
end
32+
33+
local is_open_dir = node.type == "directory" and (node:is_expanded() or node.empty_expanded)
3234
if use_parent and not is_open_dir then
3335
return tree:get_node(node:get_parent_id())
3436
end

0 commit comments

Comments
 (0)