summaryrefslogtreecommitdiff
path: root/src/normal.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-11-13 17:36:04 +0800
committerMaxime Coste <mawww@kakoune.org>2017-11-13 17:36:04 +0800
commit706c1672d52967e7dd6ad9d92c4dfa3a6f15744e (patch)
tree108660e69d43989ed7bb97d9afd663c8b5a47406 /src/normal.cc
parent5f5188a89c8a9c120d85c59461e8c283741d6d5c (diff)
Normal: add <a-S> to select first and last char of selection
Fixes #550
Diffstat (limited to 'src/normal.cc')
-rw-r--r--src/normal.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/normal.cc b/src/normal.cc
index 9a407ec1..1166ae30 100644
--- a/src/normal.cc
+++ b/src/normal.cc
@@ -932,6 +932,19 @@ void split_lines(Context& context, NormalParams)
selections = std::move(res);
}
+void select_boundaries(Context& context, NormalParams)
+{
+ auto& selections = context.selections();
+ Vector<Selection> res;
+ for (auto& sel : selections)
+ {
+ res.push_back(sel.min());
+ if (sel.min() != sel.max())
+ res.push_back(sel.max());
+ }
+ selections = std::move(res);
+}
+
void join_lines_select_spaces(Context& context, NormalParams)
{
auto& buffer = context.buffer();
@@ -2011,6 +2024,7 @@ static const HashMap<Key, NormalCmd, MemoryDomain::Undefined, KeymapBackend> key
{ {'s'}, {"select regex matches in selected text", select_regex} },
{ {'S'}, {"split selected text on regex matches", split_regex} },
{ {alt('s')}, {"split selected text on line ends", split_lines} },
+ { {alt('S')}, {"select selection boundaries", select_boundaries} },
{ {'.'}, {"repeat last insert command", repeat_last_insert} },
{ {alt('.')}, {"repeat last object select/character find", repeat_last_select} },