Helix, a modern editor for linux

Posted on September 18, 2022 by Adrian Wyssmann ‐ 3 min read

When working on the shell (locally or remotely) and I need to modify a file, I usually use vi. However, I often miss features like syntax highlighting or properly managing indentation,. This is where helix shines.

Why helix?

helix is a single binary, built in Rust and works well also over ssh.

  • Multiple selection allows concurrent code editing in different places7
  • Tree-sitter integration for better syntax highlighting, indent calculation and code navigation. tree-sitter is a parser, which generates a syntax tree for a source file and lets you efficiently update the syntax tree as the source file
  • Powerful code manipulation by navigate and select functions, classes, comments, etc and select syntax tree nodes provided by tree-sitter
  • Language Server support which provides language specific auto completion, goto definition, documentation, and more, out of the box.
  • Fuzzy finder to jump to files and symbols, project wide search, beautiful themes, auto closing bracket pairs, surround integration and more.
example syntax highlighting
Syntax highlighting of Java source code

Migrating from vim

One important difference for vim users is to note, that helix follows the selection → action model. This means you always have to select first the element (character, word, line) you want to work with and then the action. For example in vim you would type dd do cut a line, in helix you first select the line x and then cut it i.e. you would type xd. See also Migrating from vim.

What is also very helpful is the command palette, so when you type : you will get the possibility to select a command:

Modes

Like vi, also helix has modes:

Mode Description
Normal Mode Navigate and manipulate the selection, search for text
[Minor Modes][minor mode] Sub-modes accessible from normal mode. It switches back to normal mode after executing a command
Insert Mode Inserting text incl. autocomplete (Ctrl-x)
[Select Mode][select mode] Similar to normal mode, but extends the selection rather than replace them

The minor modes are

Mode Description
View Mode View mode is intended for scrolling and manipulating the view without changing the selection
Goto Mode Jumps to various locations
Match Mode Enter this mode using m from normal mode. See the relevant section in Usage for an explanation about surround and textobject usage
Window Mode Manipulate (split) and navigate between windows.
Space Mode This layer is a kludge of mappings, mostly pickers.

Conclusion

helix is very fast and has a very nice set of features, especially the syntax highlighting and formatting support is helpful for me as Platform Engineer. Although I am still getting used to the difference to vim - first do the selection and then the action - I already see that this is a more intuitive way to work with text elements. It definitively helps that it is visually visible, what is selected. For more information I recommend to read the official wiki.