Skip to content

Commit e96fd85

Browse files
saifulapmpynappo
andauthored
fix(file-nesting): ensure deterministic rule application (#1602)
Co-authored-by: pynappo <[email protected]>
1 parent 1acfbfd commit e96fd85

File tree

3 files changed

+284
-151
lines changed

3 files changed

+284
-151
lines changed

doc/neo-tree.txt

+27-1
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,33 @@ This will render:
13431343

13441344
The default mapping to expand/collapse nested files is <space>.
13451345

1346-
1346+
A `priority` field can be added to each rule to resolve conflicting rules. The
1347+
default priority is 100. In the event that two rules may match the same file,
1348+
the rule with higher priority will win. If the priorities are the same, the
1349+
rule with a lower key value will win.
1350+
>lua
1351+
require("neo-tree").setup({
1352+
nesting_rules = {
1353+
["bar"] = {
1354+
pattern = "(.+)%.bar$",
1355+
files = { "%1.baz" },
1356+
priority = 100,
1357+
},
1358+
["foo"] = {
1359+
pattern = "(.+)%.foo$",
1360+
files = { "%1.baz" },
1361+
priority = 200,
1362+
},
1363+
-- Without the priorities, "bar" < "foo", so bar would apply first.
1364+
}
1365+
})
1366+
<
1367+
This will render:
1368+
>
1369+
a.bar
1370+
a.foo
1371+
a.baz
1372+
<
13471373
HIGHLIGHTS *neo-tree-highlights*
13481374

13491375
The following highlight groups are defined by this plugin. If you set any of

0 commit comments

Comments
 (0)