Mar 09, 2020

The Joy of modal editors

I've been using Kakoune for more than two years as my main editor.

Kakoune is a modal editor, much like vim. It's the first one I've ever learned. I used the usual suspects before that, mainly Atom and Sublime Text. There was something about modal editing and vim in particular that made me think I was missing out on something. I tried learning vim for months, but couldn't do it. I forced myself to use it on a daily basis. It just didn't click.

That's how I arrived at Kakoune. It's very similar to vim in some aspects, but takes on a fundamentally different direction to deserve being a separate project. Kakoune is awesome. I managed to get into modal editing thanks to it. Learning modal editors requires effort but they're a joy to use.

 

Practice

This is not going to be a Kakoune guide. I followed along the TRAMPOLINE tutorial many times, it was really helpful in building the muscle memory. I have a custom config, however I only use 2 plugins. I try to keep my configuration minimal, trimming down my needs as much as possible. This forces me to understand what I really need, and get rid of all the rest. It's an idea I took away from the vim community. There are people that treat vim as a full fledged editor, installing dozens of plugins and making it indistinguishable from a desktop app. Nothing wrong with that, but I don't like having too many moving parts. There are other people in the vim community that try to use vim as raw as possible, with very little custom configuration.

I really like that. Firstly, it forces you to learn the editor as it was conceived. Yes vim is very old. Some ideas haven't aged that well. But you want to use it as the authors intended. I don't want to turn it into VS Code, otherwise might as well just use that. The other reason is that you'll be productive in any environment with vim installed. You won't be relying on any extra plugins. You'll have mastered the editor as is.

Of course, going fully barebones is crazy, and some plugins really make a difference. But the takeaway for me is to be mindful about what you're bringing in. Revisit your configuration from time to time, see if you can trim it. See if there's a shortcut you wish you had. Take away as much as possible and stick to a core set of features and plugins that you really know well and use day in and out (this whole mantra I learned from my friend Tom).

 

Feelings

I love the visceral feeling of writing in a modal editor. You can only use your keyboard, no mouse. The goal is to compose basic operations in the most efficient way possible. There's a tiny challenge everytime you need to do something, and a tiny adrenaline shot everytime you nail some command chain. That's what keeps me coming back to modal editing, especially with Kakoune. I have a workflow that I really enjoy, and it's completely mouse free.

To be clear, that's nothing to brag about. I'm 100% convinced I'm missing out on a lot of great features implemented in VS Code that I'd enjoy. (In fact, I regularly go back to VS Code. I really like it.). It's not even about the speed or the efficiency of writing software with modal editors. I used to write code in Sublime Text and I was really really fast. I have probably slowed down a bit, definitely haven't improved on that side. But I enjoy it more, I find it more satisfying. I feel closer to the machine.

Working on a terminal all day gives you a weird sensation. The low detail, the block-y interface, the lack of colours, it's all part of the experience. And it's definitely not just Kakoune. I use tmux and zsh as much as my editor. My workflow has a very specific shape now. Still, I love seeing it improve a tiny bit whenever I discover the odd trick or a new command/tool.

 

Conclusion

It's definitely worth getting into modal editing.

At least give it a try. You don't have to start with Kakoune. I had no experience with vim before and I found the inverse selection-command workflow in Kakoune much more predictable and inline with the way I think. But maybe vim is for you. I still use vim from time to time and it's valuable being able to operate it, even if at a basic level. Vim is something you'll find on any machine you'll get to work with. That includes servers but also colleagues' computers.

Modal editing is fun, rewarding and it's just something worth learning. It might not make you faster, or a better developer. You might completely hate it. There are a lot of quirks with the command line that you will avoid by never getting outside the comfort of your IDE. I might not be faster, but editing and working with Kakoune made me slightly happier. Shaping up my workflow with a few command line tools (that I use at a very basic level) made my programming days more enjoyable. I encourage you try!

 

I only use two Kakoune plugins: fzf.kak and edit-or-dir (yes, it's deprecated, but it works for me).


You can follow me on Twitter @_alpacaaa.