Skip to content

Commit b073059

Browse files
committed
feat: show action mappings in help pages
1 parent 5fe78fd commit b073059

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

denops/fall/util/mapping.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ export async function buildMappingHelpPages(
1717
): Promise<Page[]> {
1818
// Collect mappings
1919
const mappings = await mapping.list(denops, "", { mode: "c" });
20-
const pattern = /^<Plug>\(fall-([^)]+)\)$/;
20+
const pattern1 = /^<Plug>\(fall-([^)]+)\)$/;
21+
const pattern2 = /^<Cmd>call\s+fall#action\(['"](.*)['"]\)<CR>$/;
2122
const records = mappings
22-
.filter((m) => pattern.test(m.rhs))
23+
.filter((m) => pattern1.test(m.rhs) || pattern2.test(m.rhs))
24+
.filter((m) => !pattern1.test(m.lhs))
2325
.map((m) => ({
2426
lhs: m.lhs,
25-
rhs: m.rhs.replace(pattern, "$1"),
27+
rhs: m.rhs.replace(pattern1, "$1").replace(pattern2, "action($1)"),
2628
}));
2729
return formatMappingHelpPage(width, height, records);
2830
}

0 commit comments

Comments
 (0)