aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-09-25 11:43:29 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-09-25 11:43:29 +0200
commit4ca158acffb798436ede54b4942d2e4a5212d1a7 (patch)
tree5f59b689ee132cb3498872f71b2f2d219f821882
parentcf2d9645e703f37d96af372b67168989862c1478 (diff)
downloadvis-4ca158acffb798436ede54b4942d2e4a5212d1a7.tar.gz
vis-4ca158acffb798436ede54b4942d2e4a5212d1a7.tar.xz
Make '$' move to the last character of a line
It is an inclusive movement, thus 'd$' works as expected.
-rw-r--r--config.def.h2
-rw-r--r--vis.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/config.def.h b/config.def.h
index a9c3456..0a59028 100644
--- a/config.def.h
+++ b/config.def.h
@@ -118,7 +118,7 @@ static KeyBinding vis_movements[] = {
{ { KEY(ENTER) }, movement, { .i = MOVE_SCREEN_LINE_DOWN } },
{ { NONE('^') }, movement, { .i = MOVE_LINE_START } },
{ { NONE('g'), NONE('_') }, movement, { .i = MOVE_LINE_FINISH } },
- { { NONE('$') }, movement, { .i = MOVE_LINE_END } },
+ { { NONE('$') }, movement, { .i = MOVE_LINE_LASTCHAR } },
{ { NONE('%') }, movement, { .i = MOVE_BRACKET_MATCH } },
{ { NONE('b') }, movement, { .i = MOVE_WORD_START_PREV } },
{ { NONE('B') }, movement, { .i = MOVE_WORD_START_PREV } },
diff --git a/vis.c b/vis.c
index b2e9360..46220b3 100644
--- a/vis.c
+++ b/vis.c
@@ -196,6 +196,7 @@ enum {
MOVE_LINE_BEGIN,
MOVE_LINE_START,
MOVE_LINE_FINISH,
+ MOVE_LINE_LASTCHAR,
MOVE_LINE_END,
MOVE_LINE_NEXT,
MOVE_LINE,
@@ -263,6 +264,7 @@ static Movement moves[] = {
[MOVE_LINE_BEGIN] = { .txt = text_line_begin, .type = LINEWISE },
[MOVE_LINE_START] = { .txt = text_line_start, .type = LINEWISE },
[MOVE_LINE_FINISH] = { .txt = text_line_finish, .type = LINEWISE },
+ [MOVE_LINE_LASTCHAR] = { .txt = text_line_lastchar, .type = LINEWISE|INCLUSIVE },
[MOVE_LINE_END] = { .txt = text_line_end, .type = LINEWISE },
[MOVE_LINE_NEXT] = { .txt = text_line_next, .type = LINEWISE },
[MOVE_LINE] = { .cmd = line, .type = LINEWISE|IDEMPOTENT},