From adf65e1dca8d3c0381133be8446eebddf412d772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 28 Dec 2020 15:17:36 +0100 Subject: vis: implement multiline to/till motions These are currently not mapped by default but can be enabled by mappings using their virtual key names. --- main.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index 9719640..858af23 100644 --- a/main.c +++ b/main.c @@ -94,7 +94,7 @@ static const char *gotoline(Vis*, const char *keys, const Arg *arg); /* make the current action use the operator indicated by arg->i */ static const char *operator(Vis*, const char *keys, const Arg *arg); /* blocks to read a key and performs movement indicated by arg->i which - * should be one of VIS_MOVE_{TO,TILL}_LINE_{RIGHT,LEFT}*/ + * should be one of VIS_MOVE_{TO,TILL}_{,LINE}_{RIGHT,LEFT}*/ static const char *movement_key(Vis*, const char *keys, const Arg *arg); /* perform the movement as indicated by arg->i */ static const char *movement(Vis*, const char *keys, const Arg *arg); @@ -220,8 +220,12 @@ enum { VIS_ACTION_TOTILL_REVERSE, VIS_ACTION_PROMPT_SEARCH_FORWARD, VIS_ACTION_PROMPT_SEARCH_BACKWARD, + VIS_ACTION_TILL_LEFT, + VIS_ACTION_TILL_RIGHT, VIS_ACTION_TILL_LINE_LEFT, VIS_ACTION_TILL_LINE_RIGHT, + VIS_ACTION_TO_LEFT, + VIS_ACTION_TO_RIGHT, VIS_ACTION_TO_LINE_LEFT, VIS_ACTION_TO_LINE_RIGHT, VIS_ACTION_REGISTER, @@ -718,6 +722,16 @@ static const KeyAction vis_action[] = { VIS_HELP("Search backward") prompt_show, { .s = "?" } }, + [VIS_ACTION_TILL_LEFT] = { + "vis-motion-till-left", + VIS_HELP("Till after the occurrence of character to the left") + movement_key, { .i = VIS_MOVE_TILL_LEFT } + }, + [VIS_ACTION_TILL_RIGHT] = { + "vis-motion-till-right", + VIS_HELP("Till before the occurrence of character to the right") + movement_key, { .i = VIS_MOVE_TILL_RIGHT } + }, [VIS_ACTION_TILL_LINE_LEFT] = { "vis-motion-till-line-left", VIS_HELP("Till after the occurrence of character to the left on the current line") @@ -728,6 +742,16 @@ static const KeyAction vis_action[] = { VIS_HELP("Till before the occurrence of character to the right on the current line") movement_key, { .i = VIS_MOVE_TILL_LINE_RIGHT } }, + [VIS_ACTION_TO_LEFT] = { + "vis-motion-to-left", + VIS_HELP("To the first occurrence of character to the left") + movement_key, { .i = VIS_MOVE_TO_LEFT } + }, + [VIS_ACTION_TO_RIGHT] = { + "vis-motion-to-right", + VIS_HELP("To the first occurrence of character to the right") + movement_key, { .i = VIS_MOVE_TO_RIGHT } + }, [VIS_ACTION_TO_LINE_LEFT] = { "vis-motion-to-line-left", VIS_HELP("To the first occurrence of character to the left on the current line") -- cgit v1.2.3