News for hackers. Stuff that matters.
Re:Kakoune – A Modal Text Editor by tombert on Tuesday March 05, 2019 @03:35PM (#19313979)
I saw this about a year ago, since I was curious if there were any editors outside of the Vi(m) family to embrace modal editing. I installed it and then forgot about it.

Sadly, even though this looks amazing, I don't see myself using it until most of the plugins I use for Vim have been ported over. Does anyone here use Kakoune as their daily driver? Do you feel it's worth the switch from Vim?

Re:Kakoune – A Modal Text Editor by sevensor on Tuesday March 05, 2019 @04:14PM (#19314311)
I switched from Vim to Kakoune about two years ago, after nearly 20 years of vi / vim. Being essentially in visual mode all the time clicked for me very fast. Since I don't use plugins, there was nothing holding me back.

I still use vi / vim for some of the usual suspects. I haven't bothered to change my $EDITOR, so I always default into vi unless I explicitly invoke kak. (Like right now, w3m invoked vi for me to write this comment.) And then there's visudo, which is far too much of a pain to set up for using kak. And kak doesn't to my knowledge have anything like vimdiff. Also, it doesn't work as well for what I call "interactive sed," where you do a global regex replacement. For ordinary source code editing though, I'm not going back. Selection-oriented editing with multiple cursors is just too much fun.

Re:Kakoune – A Modal Text Editor by thristian on Tuesday March 05, 2019 @04:55PM (#19314623)
One of my favourite things about Kakoune is global regex replacement. In Vim, it usually goes like:

- Type `:%s/`

- Spend 30 seconds thinking up a regex which will hopefully match all the things I want to change, and none of the things I don't

- Write it out, hit Enter

- Run my tests, or run "git diff", or generally review the changes, and find a bunch of stuff is broken

- undo, restart from scratch

You can sometimes avoid screwing up the entire file with the "c" flag that asks for confirmation for each change, but it's too easy to get bored and distracted and type "y" too many times.

In Kakoune, a global regex replacement goes like:

- Type `%s`

- Spend five seconds thinking up a regex that approximately matches the things I want to change

- Interactively do any additional adjustments that are difficult to express in regex, like the `M` command that extends the selection to the next matching bracket

- Cycle through matches with `(` and `)`, checking to see if they're what I expected

- If not, I can remove individual selections with Alt-Space, or just hit %s and adjust my regex

- Type `c` and actually make the change

Because of the whole "multiple cursors" thing, I can get fast feedback on each part of the process, so I can get the result I want much more quickly.

Re:Kakoune – A Modal Text Editor by gopher_protocol on Tuesday March 05, 2019 @06:12PM (#19315105)
I'm not arguing that Kakoune's way isn't better (I think it probably is). But you can sort of do this in Vim as well, minus the more advanced interactive adjustments:

- :set hlsearch

- Type `/`

- Spend five seconds thinking up a regex that approximately matches the things I want to change

- Hit Enter

- Cycle through matches with `n`/`N`, checking to see if they're what I expected

- If they're not, press `/` then <Up> and edit the regex

- When satisfied, type `:%s//`, enter the replacement you want to make, then `/g<Enter>` to apply the change everywhere

Re:Kakoune – A Modal Text Editor by Deimorz on Tuesday March 05, 2019 @06:21PM (#19315157)
You can also just change the command to something like :%s/regex/replacement/gc

The "c" modifier makes you confirm each replacement, and you can y/n for each of them.

Re:Kakoune – A Modal Text Editor by cesnja on Wednesday March 06, 2019 @02:43PM (#19322014)
I'm not sure what's the library providing the functionality, but regex replace is super nice in the Spacemacs emacs distribution. It takes the same arguments as vim, but shows and highlights the changes your regex will do while you're writing it out.
Re:Kakoune – A Modal Text Editor by sevensor on Tuesday March 05, 2019 @09:54PM (#19316079)
Much as I love kak, multiple selections can work against you for this use case. If the file is big enough, and there are enough matches, kak falls over long before vim breaks a sweat. I'm happy to use vim for one thing and kak for another.
Re:Kakoune – A Modal Text Editor by petepete on Tuesday March 05, 2019 @03:43PM (#19314040)
I posted it on here some time last year and tried switching from Vim.

The only thing stopping me was my inability to configure it to use different indentation settings per file type.

I'll definitely try again at some point. I love Vim and have used it for nearly twenty years, but Kakoune's grammar just makes more sense in several ways.

Re:Kakoune – A Modal Text Editor by TeddyDD on Tuesday March 05, 2019 @04:46PM (#19314554)
I've been using it as daily driver for a while. I switched when I realized I'm constantly tried to use Kakoune editing commands in Spacemacs...

Do you mind listing plugins you miss? That's probably depends on use-case but my impression is most of essential stuff is already available.

Re:Kakoune – A Modal Text Editor by tombert on Tuesday March 05, 2019 @05:23PM (#19314830)
I don't mind, but I currently use Fireplace for Clojure, Intero NeoVim for Haskell, and the vim-fsharp plugin. As far as I'm aware, there are no direct ports of those for Kakoune.
Re:Kakoune – A Modal Text Editor by TeddyDD on Tuesday March 05, 2019 @05:38PM (#19314931)
Fair point, Kakoune still lacks when it comes to in-depth integration with tools for specific languages. There is good LSP integration but unfortunately LSP alone won't turn editor into IDE.