aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-01-20 12:56:38 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-01-20 12:56:38 +0100
commitb9e8d20523a7bf05e02468efd97bbcf90f18a1e0 (patch)
treed9bfb959b09bce405216449aad0f3a526f7bfcc1
parenta552b071a0f88153ba5ff462fcdf4461ff4f2a16 (diff)
downloadvis-b9e8d20523a7bf05e02468efd97bbcf90f18a1e0.tar.gz
vis-b9e8d20523a7bf05e02468efd97bbcf90f18a1e0.tar.xz
vis: make <End> in insert/replace mode move to the end of line
The behaviour of <End> vs $ in various modes may still be inconsistent, but at least it can now be configured via key bindings.
-rw-r--r--config.def.h3
-rw-r--r--main.c6
2 files changed, 8 insertions, 1 deletions
diff --git a/config.def.h b/config.def.h
index a395bcf..30e17bb 100644
--- a/config.def.h
+++ b/config.def.h
@@ -38,7 +38,7 @@ static const KeyBinding bindings_motions[] = {
{ "g<Down>", ALIAS("gj") },
{ "^", ACTION(CURSOR_LINE_START) },
{ "g_", ACTION(CURSOR_LINE_FINISH) },
- { "$", ACTION(CURSOR_LINE_END) },
+ { "$", ACTION(CURSOR_LINE_LASTCHAR) },
{ "%", ACTION(CURSOR_BRACKET_MATCH) },
{ "b", ACTION(CURSOR_WORD_START_PREV) },
{ "B", ACTION(CURSOR_LONGWORD_START_PREV) },
@@ -232,6 +232,7 @@ static const KeyBinding bindings_normal[] = {
{ "gp", ACTION(PUT_AFTER_END) },
{ "gP", ACTION(PUT_BEFORE_END) },
{ "~", ALIAS("<vis-operator-case-swap>l") },
+ { "<End>", ALIAS("$") },
{ 0 /* empty last element, array terminator */ },
};
diff --git a/main.c b/main.c
index 7cb7350..8384ff6 100644
--- a/main.c
+++ b/main.c
@@ -126,6 +126,7 @@ enum {
VIS_ACTION_CURSOR_LINE_FINISH,
VIS_ACTION_CURSOR_LINE_BEGIN,
VIS_ACTION_CURSOR_LINE_END,
+ VIS_ACTION_CURSOR_LINE_LASTCHAR,
VIS_ACTION_CURSOR_SCREEN_LINE_UP,
VIS_ACTION_CURSOR_SCREEN_LINE_DOWN,
VIS_ACTION_CURSOR_SCREEN_LINE_BEGIN,
@@ -352,6 +353,11 @@ static KeyAction vis_action[] = {
[VIS_ACTION_CURSOR_LINE_END] = {
"cursor-line-end",
"Move cursor to end of the line",
+ movement, { .i = VIS_MOVE_LINE_END }
+ },
+ [VIS_ACTION_CURSOR_LINE_LASTCHAR] = {
+ "cursor-line-lastchar",
+ "Move cursor to last character of the line",
movement, { .i = VIS_MOVE_LINE_LASTCHAR }
},
[VIS_ACTION_CURSOR_SCREEN_LINE_UP] = {