summaryrefslogtreecommitdiff
path: root/src/normal.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-03-26 13:13:05 +0000
committerMaxime Coste <frrrwww@gmail.com>2015-03-26 13:34:21 +0000
commit757366472b7c70e54e0e145b286ea01090ee5dbc (patch)
tree31ced2c37ff1dd630313e7a4ee92ce6ad11b580b /src/normal.cc
parent9f5b064a87bc72eaa5f6534ed946a679321ffcbf (diff)
Add <alt-:> for ensuring selections are forward (cursor >= anchor)
Not very useful interactively, but that feature can make macros much more robust.
Diffstat (limited to 'src/normal.cc')
-rw-r--r--src/normal.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/normal.cc b/src/normal.cc
index 1d4d1cba..eec19752 100644
--- a/src/normal.cc
+++ b/src/normal.cc
@@ -1373,6 +1373,11 @@ void flip_selections(Context& context, NormalParams)
flip_selections(context.selections());
}
+void ensure_forward(Context& context, NormalParams)
+{
+ ensure_forward(context.selections());
+}
+
static NormalCmdDesc cmds[] =
{
{ 'h', "move left", move<CharCount, Backward> },
@@ -1434,6 +1439,7 @@ static NormalCmdDesc cmds[] =
{ alt(' '), "remove main selection", remove_selection },
{ ';', "reduce selections to their cursor", clear_selections },
{ alt(';'), "swap selections cursor and anchor", flip_selections },
+ { alt(':'), "ensure selection cursor is after anchor", ensure_forward },
{ 'w', "select to next word start", repeated<&select<SelectMode::Replace, select_to_next_word<Word>>> },
{ 'e', "select to next word end", repeated<select<SelectMode::Replace, select_to_next_word_end<Word>>> },