vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 73958499418d52929d1771077150e390c17204cc parent 5be7017812361e7ce01b806938945ec3f548165e Author: Marc André Tanner <mat@brain-dump.org> Date: Wed, 10 Sep 2014 19:20:20 +0200 Add normal command 'S' as asynonym for 'cc' Diffstat:
| M | config.def.h | | | 1 | + |
| M | vis.c | | | 7 | +++++++ |
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/config.def.h b/config.def.h @@ -346,6 +346,7 @@ static KeyBinding vis_normal[] = { { { NONE('i') }, switchmode, { .i = VIS_MODE_INSERT } }, { { NONE('v') }, switchmode, { .i = VIS_MODE_VISUAL } }, { { NONE('R') }, switchmode, { .i = VIS_MODE_REPLACE} }, + { { NONE('S') }, operator_twice, { .i = OP_CHANGE } }, { { NONE('u') }, undo, { NULL } }, { { CONTROL('R') }, redo, { NULL } }, { { CONTROL('L') }, call, { .f = editor_draw } }, diff --git a/vis.c b/vis.c @@ -321,6 +321,8 @@ static void count(const Arg *arg); static void linewise(const Arg *arg); /* make the current action use the operator indicated by arg->i */ static void operator(const Arg *arg); +/* execute operator twice useful for synonyms (e.g. 'cc') */ +static void operator_twice(const Arg *arg); /* blocks to read a key and performs movement indicated by arg->i which * should be one of MOVE_{RIGHT,LEFT}_{TO,TILL} */ static void movement_key(const Arg *arg); @@ -527,6 +529,11 @@ static void operator(const Arg *arg) { } } +static void operator_twice(const Arg *arg) { + operator(arg); + operator(arg); +} + static void movement_key(const Arg *arg) { Key k = getkey(); if (!k.str[0]) {