vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit bb55ac21570750f1ce6ef46495c14e07484a1d3f
parent 841d6fe0b6779b563b1fd4cb797f643d6002b723
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Mon,  8 Sep 2014 14:20:47 +0200

Zero can be both a movement and part of a multiplier

Diffstat:
Mconfig.def.h | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/config.def.h b/config.def.h @@ -451,6 +451,13 @@ void action_do(Action *a) { } } +static void zero(const Arg *arg) { + if (action.count == 0) + movement(&(const Arg){ .i = MOVE_LINE_BEGIN }); + else + count(&(const Arg){ .i = 0 }); +} + static void delete_word(const Arg *arg) { operator(&(const Arg){ .i = OP_DELETE }); movement(&(const Arg){ .i = MOVE_WORD_START_PREV }); @@ -527,7 +534,6 @@ static KeyBinding vis_movements[] = { { { CONTROL('J') }, movement, { .i = MOVE_LINE_DOWN } }, { { CONTROL('N') }, movement, { .i = MOVE_LINE_DOWN } }, { { KEY(ENTER) }, movement, { .i = MOVE_LINE_DOWN } }, - { { NONE('0') }, movement, { .i = MOVE_LINE_BEGIN } }, { { NONE('^') }, movement, { .i = MOVE_LINE_START } }, { { NONE('g'), NONE('_') }, movement, { .i = MOVE_LINE_FINISH } }, { { NONE('$') }, movement, { .i = MOVE_LINE_END } }, @@ -587,6 +593,7 @@ static KeyBinding vis_textobjs[] = { }; static KeyBinding vis_operators[] = { + { { NONE('0') }, zero, { NULL } }, { { NONE('1') }, count, { .i = 1 } }, { { NONE('2') }, count, { .i = 2 } }, { { NONE('3') }, count, { .i = 3 } },