Helix, a great alternative to vim

Published:

I have always been torn between text editors and IDEs when writing code. Text editors often lack some features that have to be complemented by plugins, while IDEs often get too complicated and in your way, which can be dangerous if you start relying on some features that you don't fully understand.

I started using vim a long time ago, and came to like its modal nature (one mode to insert text, one mode to select text, one mode to modify the selection). However, without many plugins, it was not really easy to use as a code editor, because you didn't get much out of it (for instance, there is no way to jump to the definition of a function under the cursor by default). When you start to dive into the available plugins, you can get lost easily, and for the frugal and lazy user I tend to be, this was too much of a hassle.

Something I enjoyed with vim was the idea of making sentences to act on the text. For instance, with the cursor under the first letter of a word in normal mode, you can replace it by typing cw, which literally stands for "change word". The flip side of this is that you cannot visualize the block of text you're going to impact. In the simple cw example, it's easy, but when you start working on lines or paragraphs, it becomes much more difficult.

A few years back, I heard about Kakoune, an alternative to vim which worked by reverting the order of the actions: you would first select the block of text to work on, then act upon it. This was a great way of dealing with text! However, much like vim, it was a text editor at heart, not so much a code editor unless you were ready to spend quite a lot of time to customize it.

Then, last year, I heard about Helix. It uses metaphors similar to Kakoune to handle text selection, but it also comes "batteries included", which means you don't have to spend a lot of time customizing it to squeeze a lot out of it.

An important feature of Helix is its support of the Language Server Protocol, which means that, much like VS Code, you can navigate code bases pretty easily without having to do much apart from installing the support library for the programming languages of your choice. In my case, as a Python developer, it means installing the python3-pylsp package and I'm good to go. To check what capabilities Helix has activated, you can run hx --health which displays a health report containing, among other things, the current level of support for many programming languages.

Here are a few things I use very often when working with Helix:

I highly recommend going through the tutorial (by running hx --tutor) to learn the basics of Helix and get to learn some of its specific features.

Finally, even though Helix defaults are pretty good, it is still highly customizable. Here are some of the changes I use:

# Lovely theme which works better than the default one with rulers (see below)
theme = "catppuccin_frappe"

[editor]
# Show currently open buffers, only when more than one exists.
# This provides a line of "buffer tabs" at the top of the screen
bufferline = "multiple"
text-width = 80
rulers = [80]
# I find the auto-completion pop-up panel a bit too much "in your face", so
# I deactivated it for the moment
auto-completion = false

[keys.normal]
# Alt-, and Alt-. to go to previous/next buffer
"A-," = "goto_previous_buffer"
"A-." = "goto_next_buffer"
# Deselect the last selected line. This is useful when you pressed x too many
# times...
X = ["extend_line_up", "extend_to_line_bounds"]
# To mimic vim's shortcut to go to the bottom of a file
G = "goto_file_end"

[editor.lsp]
# Disable automatically popups of signature parameter help that take up quite
# a lot of space.
auto-signature-help = false

I highly recommend this editor. The documentation is rather comprehensive, and the community is very nice and always ready to help, so give it a try!