In recent versions of Kakoune, I see that +
in normal mode “duplicates each selection (generating overlapping selections)”. I tried it and it does work, but what is the use case of this command? I could not think of any good reason for using this selection-duplication mechanism.
It’s also something I don’t fully understand why it’s there, since it breaks the orthogonal design…
Imagine that you want to type ../
10 times:
../../../../../../../../../../
you could either do:
-
i../<esc>x_y9p
(select the line and paste it 9 times) -
i../<esc>x_9+yp
(select the line 9 times and paste the selections once) -
10+i../
(duplicate the selection 10 times and just type../
, arguably the best one)
Note that the behavior of +
is a bit particular. A count will generate that many selections, but pressing +
subsequently will duplicate the selections at each press: 2 → 4 → 8 → 16 and so forth.
10+i../
(duplicate the selection 10 times and just type../
, arguably the best one)
Before +
was added, this was already possible as 10o<backspace>../
However, it seemed non-orthogonal to have to insert newlines and backspace over them, so a new key was added that just set up the “overlapping cursors” state directly.