Map undo selection change to <a-u>/<a-U>

Change the initial <c-h>/<c-k> bindings to the recently freed-up
<a-u></a-U>.

Pros:
- easier to remember
- the redo binding is logical.
- works on legacy terminals, unlike <c-h>

Cons:
- It's less convenient to toggle between selection undo and redo
  keys. I think this is okay since this scenario does not happen that
  often in practice.
This commit is contained in:
Johannes Altmanninger 2023-05-08 22:38:22 +02:00
parent 2adc81c4c9
commit 7d2bae63b9
6 changed files with 8 additions and 8 deletions

View File

@ -308,10 +308,10 @@ Yanking (copying) and pasting use the *"* register by default (See <<registers#,
*U*:: *U*::
redo last change redo last change
*<c-h>*:: *<a-u>*::
undo last selection change undo last selection change
*<c-k>*:: *<a-U>*::
redo last selection change redo last selection change
*&*:: *&*::

View File

@ -2340,8 +2340,8 @@ static constexpr HashMap<Key, NormalCmd, MemoryDomain::Undefined, KeymapBackend>
{ {'u'}, {"undo", undo} }, { {'u'}, {"undo", undo} },
{ {'U'}, {"redo", redo} }, { {'U'}, {"redo", redo} },
{ {ctrl('h')}, {"undo selection change", undo_selection_change<Backward>} }, { {alt('u')}, {"undo selection change", undo_selection_change<Backward>} },
{ {ctrl('k')}, {"redo selection change", undo_selection_change<Forward>} }, { {alt('U')}, {"redo selection change", undo_selection_change<Forward>} },
{ {alt('i')}, {"select inner object", select_object<ObjectFlags::ToBegin | ObjectFlags::ToEnd | ObjectFlags::Inner>} }, { {alt('i')}, {"select inner object", select_object<ObjectFlags::ToBegin | ObjectFlags::ToEnd | ObjectFlags::Inner>} },
{ {alt('a')}, {"select whole object", select_object<ObjectFlags::ToBegin | ObjectFlags::ToEnd>} }, { {alt('a')}, {"select whole object", select_object<ObjectFlags::ToBegin | ObjectFlags::ToEnd>} },

View File

@ -1,2 +1,2 @@
ui_out -ignore 4 ui_out -ignore 4
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "gjgkxd<c-h>ihere<esc>" ] }' ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "gjgkxd<a-u>ihere<esc>" ] }'

View File

@ -1,2 +1,2 @@
ui_out -ignore 4 ui_out -ignore 4
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "2jj<c-h><c-h><c-k>ihere<esc>" ] }' ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "2jj<a-u><a-u><a-U>ihere<esc>" ] }'

View File

@ -1,2 +1,2 @@
ui_out -ignore 4 ui_out -ignore 4
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "j2j<c-h><c-h>ihere<esc>" ] }' ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "j2j<a-u><a-u>ihere<esc>" ] }'

View File

@ -1,2 +1,2 @@
ui_out -ignore 4 ui_out -ignore 4
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "j:buffer *debug*<ret><c-h>ihere<esc>" ] }' ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "j:buffer *debug*<ret><a-u>ihere<esc>" ] }'