aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editor.h1
-rw-r--r--vis.c13
2 files changed, 10 insertions, 4 deletions
diff --git a/editor.h b/editor.h
index 3b555bf..7719f3d 100644
--- a/editor.h
+++ b/editor.h
@@ -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;
diff --git a/vis.c b/vis.c
index 72889ab..9e397c4 100644
--- a/vis.c
+++ b/vis.c
@@ -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 */