aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-09-10 19:20:20 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-09-10 19:20:20 +0200
commit8910f3fc969ebc64c3f71d162cc9383cf197cdba (patch)
treea63d60a19feb2ea087087524a5d3fe5de91014d9
parentac669ee5d2e43f60491fe22413afe6c09455b191 (diff)
downloadvis-8910f3fc969ebc64c3f71d162cc9383cf197cdba.tar.gz
vis-8910f3fc969ebc64c3f71d162cc9383cf197cdba.tar.xz
Add normal command 'S' as asynonym for 'cc'
-rw-r--r--config.def.h1
-rw-r--r--vis.c7
2 files changed, 8 insertions, 0 deletions
diff --git a/config.def.h b/config.def.h
index d706974..1a7d383 100644
--- 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
index cb55d98..fe7d4c1 100644
--- 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]) {