ulyssa / modalkit

A Rust library for building modal editing applications
Apache License 2.0
49 stars 5 forks source link

Support repeating last edit #48

Closed ulyssa closed 1 year ago

ulyssa commented 1 year ago

Vim's . will repeat the last edit sequence, optionally overriding either the count argument or the register. This is usually a non-motion, non-yank operation, but movements associated with entering Insert mode (i/I/a/A) are included, making it possible to use . to repeat prepending or appending text.

Emacs also supports repeating actions with C-x z, but in its case it is only the very last action, and not a sequence. The count can also be overriden, making it possible to do things like c M-5 C-x z to type the letter c, and then repeating typing it 5 times.

In Kakoune, you can repeat an edit sequence with ., and you can also repeat certain selection commands with <A-.>.

In order to support all of these different styles, I'm going to add support to ModalMachine for tracking different sequences of generated actions by delegating to Mode for determining when and how an action is tracked.