From 78ae3873653e3a24a215df339da407ccef3003dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 21 Apr 2016 14:26:08 +0200 Subject: vis: also show user registered :-commands in :help output --- vis-cmds.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'vis-cmds.c') diff --git a/vis-cmds.c b/vis-cmds.c index 827cc5c..6be5fd8 100644 --- a/vis-cmds.c +++ b/vis-cmds.c @@ -546,9 +546,12 @@ static void print_mode(Mode *mode, Text *txt) { } static bool print_action(const char *key, void *value, void *data) { - Text *txt = data; KeyAction *action = value; - return text_appendf(txt, " %-30s\t%s\n", key, action->help); + return text_appendf(data, " %-30s\t%s\n", key, action->help); +} + +static bool print_cmd(const char *key, void *value, void *data) { + return text_appendf(data, " %s\n", key); } static void print_symbolic_keys(Vis *vis, Text *txt) { @@ -647,8 +650,7 @@ static bool cmd_help(Vis *vis, Win *win, Command *cmd, const char *argv[], Curso print_mode(&vis_modes[VIS_MODE_INSERT], txt); text_appendf(txt, "\n :-Commands\n\n"); - for (const CommandDef *cmd = cmds; cmd && cmd->name[0]; cmd++) - text_appendf(txt, " %s\n", cmd->name[0]); + map_iterate(vis->cmds, print_cmd, txt); text_appendf(txt, "\n Key binding actions\n\n"); map_iterate(vis->actions, print_action, txt); -- cgit v1.2.3