diff options
| -rw-r--r-- | editor.h | 1 | ||||
| -rw-r--r-- | vis.c | 13 |
2 files changed, 10 insertions, 4 deletions
@@ -33,6 +33,7 @@ typedef struct { /* returns a pointer to the first not consumed character in keys * or NULL if not enough input was available to complete the command */ const Arg arg; + const char *alias; } KeyBinding; typedef struct Mode Mode; @@ -2625,10 +2625,15 @@ static const char *keypress(const char *input) { *end = tmp; if (binding) { /* exact match */ - end = (char*)binding->func(end, &binding->arg); - if (!end) - break; - start = cur = end; + if (binding->func) { + end = (char*)binding->func(end, &binding->arg); + if (!end) + break; + start = cur = end; + } else { /* alias */ + buffer_put0(&vis->input_queue, end); + buffer_prepend0(&vis->input_queue, binding->alias); + } } else if (prefix) { /* incomplete key binding? */ cur = end; } else { /* no keybinding */ |
