diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-10-26 19:57:54 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-10-27 11:13:07 +0100 |
| commit | 321cf83fba85c70d0bdc89a07e8af4148127f23c (patch) | |
| tree | 9bd5d6e59aabec42bd0214dff2e3710523319037 /main.c | |
| parent | d8d0bb600c7984e23b95b7fdbfe59743b388a75c (diff) | |
| download | vis-321cf83fba85c70d0bdc89a07e8af4148127f23c.tar.gz vis-321cf83fba85c70d0bdc89a07e8af4148127f23c.tar.xz | |
vis: introduce pseudo operators for put
In principle put is not really an operator, however it still
should be repeatable and respect count.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 17 |
1 files changed, 4 insertions, 13 deletions
@@ -31,8 +31,6 @@ static const char *insert(Vis*, const char *keys, const Arg *arg); static const char *insert_tab(Vis*, const char *keys, const Arg *arg); /* inserts a newline (either \n or \r\n depending on file type) */ static const char *insert_newline(Vis*, const char *keys, const Arg *arg); -/* put register content according to arg->i */ -static const char *put(Vis*, const char *keys, const Arg *arg); /* add a new line either before or after the one where the cursor currently is */ static const char *openline(Vis*, const char *keys, const Arg *arg); /* join lines from current cursor position to movement indicated by arg */ @@ -822,22 +820,22 @@ static KeyAction vis_action[] = { [VIS_ACTION_PUT_AFTER] = { "put-after", "Put text after the cursor", - put, { .i = PUT_AFTER } + operator, { .i = OP_PUT_AFTER } }, [VIS_ACTION_PUT_BEFORE] = { "put-before", "Put text before the cursor", - put, { .i = PUT_BEFORE } + operator, { .i = OP_PUT_BEFORE } }, [VIS_ACTION_PUT_AFTER_END] = { "put-after-end", "Put text after the cursor, place cursor after new text", - put, { .i = PUT_AFTER_END } + operator, { .i = OP_PUT_AFTER_END } }, [VIS_ACTION_PUT_BEFORE_END] = { "put-before-end", "Put text before the cursor, place cursor after new text", - put, { .i = PUT_BEFORE_END } + operator, { .i = OP_PUT_BEFORE_END } }, [VIS_ACTION_CURSOR_SELECT_WORD] = { "cursors-select-word", @@ -1562,13 +1560,6 @@ static const char *insert_newline(Vis *vis, const char *keys, const Arg *arg) { return keys; } -static const char *put(Vis *vis, const char *keys, const Arg *arg) { - vis->action.arg = *arg; - vis_operator(vis, OP_PUT); - vis_motion(vis, MOVE_NOP); - return keys; -} - static const char *openline(Vis *vis, const char *keys, const Arg *arg) { if (arg->i == MOVE_LINE_NEXT) { vis_motion(vis, MOVE_LINE_END); |
