1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-18 08:51:46 +03:00

Normal: add <a-S> to select first and last char of selection

Fixes #550
This commit is contained in:
Maxime Coste 2017-11-13 17:36:04 +08:00
parent 5f5188a89c
commit 706c1672d5
2 changed files with 19 additions and 2 deletions

View File

@ -513,11 +513,14 @@ to skim through the jump list using:
*s*::
create a selection
*S*::
split the current selection
*<a-s>*::
split the current selections on line boundaries
*S*::
split the current selection
*<a-S>*::
select first and last characters of each selections
*C*::
copy the current selection to the next line

View File

@ -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} },