add <a-R> for rotating selections content
This commit is contained in:
parent
6331fb5a61
commit
6e5ff644f2
|
@ -80,10 +80,11 @@ Basic Movement
|
||||||
* _N_: add a new selection with next match
|
* _N_: add a new selection with next match
|
||||||
* _alt-n_: replace main selection with next match (preserving the others)
|
* _alt-n_: replace main selection with next match (preserving the others)
|
||||||
|
|
||||||
* _alt-c_: center main selection in current window
|
|
||||||
* _pageup_: scroll up
|
* _pageup_: scroll up
|
||||||
* _pagedown_: scroll down
|
* _pagedown_: scroll down
|
||||||
|
|
||||||
|
* _alt-r_: rotate selections (the main selection becomes the next one)
|
||||||
|
|
||||||
Appending
|
Appending
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
@ -141,6 +142,8 @@ Changes
|
||||||
* _~_: to upper case
|
* _~_: to upper case
|
||||||
* _alt-`_: swap case
|
* _alt-`_: swap case
|
||||||
|
|
||||||
|
* _alt-R_: rotate selections content
|
||||||
|
|
||||||
Goto Commands
|
Goto Commands
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|
|
@ -658,6 +658,19 @@ void rotate_selections(Context& context)
|
||||||
context.editor().rotate_selections(count);
|
context.editor().rotate_selections(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rotate_selections_content(Context& context)
|
||||||
|
{
|
||||||
|
int count = context.numeric_param();
|
||||||
|
if (count == 0)
|
||||||
|
count = 1;
|
||||||
|
Editor& editor = context.editor();
|
||||||
|
auto strings = editor.selections_content();
|
||||||
|
count = count % strings.size();
|
||||||
|
std::rotate(strings.begin(), strings.end()-count, strings.end());
|
||||||
|
editor.insert(strings, InsertMode::Replace);
|
||||||
|
editor.rotate_selections(count);
|
||||||
|
}
|
||||||
|
|
||||||
enum class SelectFlags
|
enum class SelectFlags
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
|
@ -951,6 +964,7 @@ KeyMap keymap =
|
||||||
{ { Key::Modifiers::Control, 's' }, save_selections },
|
{ { Key::Modifiers::Control, 's' }, save_selections },
|
||||||
|
|
||||||
{ { Key::Modifiers::Alt, 'r' }, rotate_selections },
|
{ { Key::Modifiers::Alt, 'r' }, rotate_selections },
|
||||||
|
{ { Key::Modifiers::Alt, 'R' }, rotate_selections_content },
|
||||||
|
|
||||||
{ { Key::Modifiers::None, 'q' }, start_or_end_macro_recording },
|
{ { Key::Modifiers::None, 'q' }, start_or_end_macro_recording },
|
||||||
{ { Key::Modifiers::None, 'Q' }, replay_macro },
|
{ { Key::Modifiers::None, 'Q' }, replay_macro },
|
||||||
|
|
Loading…
Reference in New Issue
Block a user