by b0rsuk · 6y ago · 0 comments
set inccommand=split
(live substitution). Vim's confirmation prompts make it more comfortable, as well as off-screen matches it shows. Multiple selections are inherently limited to a single screen or you won't be able to see what you're doing.
Verdict: a gimmick.
It ends up being much more powerful because the editing language is strictly more expressive than regular expressions: you can select using a regular expression, but you can also use all the rest of the normal mode, such as select/jump to the matching parenthesis or brace (or whatever pair of text your language use to scope things), which is not possible to express in pure regex.
You are far from limited to a single screen, the `(` and `)` commands rotate the main selection, so you can inspect all your selections easily if you want to.
In my experience (as a long time Vim user and as Kakoune's main author) multiple selections end-up being much more attractive for quick edits where there's only a handful instances to replace than devising the correct regex/replacement pair, and their interactive nature makes them quicker to use than the macro alternative (which is also supported in Kakoune).
In summary: great job with Kakoune! I'm a delighted user.
I worked with large and messy codebase, where apparently there was always something more important than cleaning up.
Think about vim (and kakoune) as basically a highly interactive language for editing text. At least at a conceptual level something like diw is basically a function (d) applied to data (iw). Vim is completely scalar. The type of all the functions is more or less something like string → string. Kakoune is the APL of text editors. Multiple selections are an array of strings to operate on. It automatically maps the function (editor commands) over every selection. I find this extremely attractive and powerful.
At least for me kakoune blows all other editors out of the water. It really is quite good.
To me however multiple selections are not Kakoune's strongest point. It's the fact that in Kakoune you "first select, then modify", while in vim you go "action first, then subject".
Putting the subject first allows for a more visual experience in general - in Kakoune you can always "see what's going to happen" before it happens, because the object is always highlighted. The multiple cursors thing is just a manifestation of this approach. In Vim the experience is more "opaque" - you type some commands in normal mode and suddenly the text changes. As a result Kak is less prone to "accidental edits" like I get in Vim from time to time.
I've heard that some people "abuse" on Vim's Visual mode to get over this limitation. But that feels like a kludge to me. And it doesn't solve the accidental edits.
The advantage of it is that you can execute the "macro" incrementally and spot early when you've made a mistake, rather than recording a macro then letting rip and discovering, too late, that there was a mistake 80% of the way though, and now you need to undo the whole thing and and try again.
(I use multiple-cursors in Emacs for multiple selections, iedit-mode for live substitution (sometimes in combination with wgrep), as well replace-regexp for plain search & replace, and while they all overlap, none are poor versions of any of the others. They each have their strengths and weaknesses. However it's vanishingly rare that I use macros any more.)