Hacker News new | ask | show | jobs
by mawww 2089 days ago
Kakoune goes the opposite way, there is no such thing as "search and replace" in it, you'd use multiselection for that.

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).

2 comments

I'd just like to add that if you want to do regex-based search and replace like in Vim, it's super easy to pipe your selection through sed. The way Kakoune implements pipes is just amazingly good. I love that if you have multiple selections, each one gets piped through the command. I love that you can undo piping your selections to another program. And while I've barely scratched the surface of what you can do with macros, I have a couple that I use constantly. After 19 years with vi and then vim, I switched to kak after trying it for a week.

In summary: great job with Kakoune! I'm a delighted user.

As I've said in a thread I made on forums a while ago, search&replace has other advantages. Reviewing matches, as long as you use /gc, is the default in vim. It's opt-in in kak, which I think is a bad default. Does kakoune even indicate you have some other selections off-screen?

I worked with large and messy codebase, where apparently there was always something more important than cleaning up.