vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 4548152124424e2e07f4da5d90042cc07ea678b7 parent 85260a25843afcb4e763f1e8fa2a0f1e4edb227a Author: Marc André Tanner <mat@brain-dump.org> Date: Wed, 20 Jan 2016 12:56:38 +0100 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. Diffstat:
| M | config.def.h | | | 3 | ++- |
| M | main.c | | | 6 | ++++++ |
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git 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 @@ -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] = {