summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2022-08-15 22:21:53 +0200
committerJohannes Altmanninger <aclopte@gmail.com>2022-09-02 02:59:47 +0200
commitc2ab5d46940bb01ab4ab2b4ef82b6829ddbadb5c (patch)
treee39c2eb2a16e58b7df486890a0a8c82fa9ac8c6f /doc
parentdd4ba2ee88747616f7125024b192cec75cd7e58c (diff)
Allow to undo and redo selection changes
From the issue: > It often happens to me that I carefully craft a selection with multiple > cursors, ready to make changes elegantly, only to completely mess it > up by pressing a wrong key (by merging the cursors for example). Being > able to undo the last selection change (even if only until the previous > buffer change) would make this much less painful. Fix this by recording selection changes and allowing simple linear undo/redo of selection changes. The preliminary key bindings are <c-h> and <c-k>. Here are some other vacant normal mode keys I considered X Y <backspace> <minus> # ^ = <plus> ' unfortunately none of them is super convenient to type. Maybe we can kick out some other normal mode command? --- This feature has some overlap with the jump list (<c-o>/<c-i>) and with undo (u) but each of the three features have their moment. Currently there's no special integration with either peer feature; the three histories are completely independent. In future we might want to synchronize them so we can implement Sublime Text's "Soft undo" feature. Note that it is possible to restore selections that predate a buffer modification. Depending on the buffer modification, the selections might look different of course. (When trying to apply an old buffer's selection to the new buffer, Kakoune computes a diff of the buffers and updates the selection accordingly. This works quite well for many practical examples.) This makes us record the full history of all selections for each client. This seems wasteful, we could set a limit. I don't expect excessive memory usage in practice (we also keep the full history of buffer changes) but I could be wrong. Closes #898
Diffstat (limited to 'doc')
-rw-r--r--doc/pages/keys.asciidoc6
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/pages/keys.asciidoc b/doc/pages/keys.asciidoc
index 73f0e432..bce3b070 100644
--- a/doc/pages/keys.asciidoc
+++ b/doc/pages/keys.asciidoc
@@ -314,6 +314,12 @@ Yanking (copying) and pasting use the *"* register by default (See <<registers#,
*<a-U>*::
move forward in history
+*<c-h>*::
+ undo last selection change
+
+*<c-k>*::
+ redo last selection change
+
*&*::
align selections, align the cursor of each selection by inserting spaces
before the first character of each selection