From f3640a2d031ad6b7efcbe92327b1ba8a570e3858 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 5 Jan 2013 18:26:57 +0100 Subject: [PATCH] alt-r rotates selections --- src/main.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main.cc b/src/main.cc index 7cd6155c..19513ff6 100644 --- a/src/main.cc +++ b/src/main.cc @@ -366,6 +366,17 @@ void do_scroll(Context& context) window.set_position(position); } +void do_rotate_selections(Context& context) +{ + int count = context.numeric_param(); + if (count == 0) + count = 1; + SelectionList sels = context.editor().selections(); + count %= sels .size(); + std::rotate(sels.begin(), sels.begin() + count, sels.end()); + context.editor().select(std::move(sels)); +}; + template class Repeated { @@ -555,6 +566,8 @@ std::unordered_map> keymap = { { Key::Modifiers::Control, 'i' }, jump }, { { Key::Modifiers::Control, 'o' }, jump }, + + { { Key::Modifiers::Alt, 'r' }, do_rotate_selections }, }; }