diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2013-10-02 19:10:31 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2013-10-02 19:10:43 +0100 |
| commit | 6e5ff644f273dc561cef0308c79a532bdaeef0ea (patch) | |
| tree | 11da6fe44ce4c61fb97c11a7e58c1938a2d1558a /src | |
| parent | 6331fb5a61a7631fa217edde277e6e091762ec3f (diff) | |
add <a-R> for rotating selections content
Diffstat (limited to 'src')
| -rw-r--r-- | src/normal.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/normal.cc b/src/normal.cc index 768801c4..1390108e 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -658,6 +658,19 @@ void rotate_selections(Context& context) 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 { None = 0, @@ -951,6 +964,7 @@ KeyMap keymap = { { Key::Modifiers::Control, 's' }, save_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' }, replay_macro }, |
