diff options
| -rw-r--r-- | config.def.h | 6 | ||||
| -rw-r--r-- | vis.c | 22 |
2 files changed, 23 insertions, 5 deletions
diff --git a/config.def.h b/config.def.h index c704b2d..b56ce4a 100644 --- a/config.def.h +++ b/config.def.h @@ -332,6 +332,10 @@ static KeyBinding vis_normal[] = { { { CONTROL('w'), NONE('k') }, call, { .f = editor_window_prev } }, { { CONTROL('F') }, cursor, { .m = window_page_up } }, { { CONTROL('B') }, cursor, { .m = window_page_down } }, + { { NONE('A') }, insertmode, { .i = MOVE_LINE_END } }, + { { NONE('C') }, change, { .i = MOVE_LINE_END } }, + { { NONE('D') }, delete, { .i = MOVE_LINE_END } }, + { { NONE('I') }, insertmode, { .i = MOVE_LINE_START } }, { { NONE('.') }, repeat, { } }, { { NONE('n') }, movement, { .i = MOVE_SEARCH_FORWARD } }, { { NONE('N') }, movement, { .i = MOVE_SEARCH_BACKWARD } }, @@ -374,7 +378,7 @@ static KeyBinding vis_readline_mode[] = { { { CONTROL('c') }, switchmode, { .i = VIS_MODE_NORMAL } }, BACKSPACE( call, f, editor_backspace_key ), { { CONTROL('D') }, call, { .f = editor_delete_key } }, - { { CONTROL('W') }, delete_word, { NULL } }, + { { CONTROL('W') }, delete, { .i = MOVE_WORD_START_PREV } }, { /* empty last element, array terminator */ }, }; @@ -339,8 +339,12 @@ static void undo(const Arg *arg); static void redo(const Arg *arg); /* either part of multiplier or a movement to begin of line */ static void zero(const Arg *arg); -/* delete from the current cursor position to the start of the previous word */ -static void delete_word(const Arg *arg); +/* hange/delete from the current cursor position to the end of + * movement as indicated by arg->i */ +static void change(const Arg *arg); +static void delete(const Arg *arg); +/* perform movement according to arg->i, then switch to insert mode */ +static void insertmode(const Arg *arg); /* insert register content indicated by arg->i at current cursor position */ static void insert_register(const Arg *arg); /* show a user prompt to get input with title arg->s */ @@ -580,9 +584,19 @@ static void zero(const Arg *arg) { count(&(const Arg){ .i = 0 }); } -static void delete_word(const Arg *arg) { +static void insertmode(const Arg *arg) { + movement(arg); + switchmode(&(const Arg){ .i = VIS_MODE_INSERT }); +} + +static void change(const Arg *arg) { + operator(&(const Arg){ .i = OP_CHANGE }); + movement(arg); +} + +static void delete(const Arg *arg) { operator(&(const Arg){ .i = OP_DELETE }); - movement(&(const Arg){ .i = MOVE_WORD_START_PREV }); + movement(arg); } static void insert_register(const Arg *arg) { |
