If you've written any kind of code, you've probably used an Integrated Development Environment (IDE), a Code Editor, a modal text editor or a normal text editor.
The article is mainly focused on a modal text editor, Helix. However, to get there we have to understand IDEs, Code editors and text editors first.
Integrated Development Environment
Wikipedia says:
An integrated development environment (IDE) is software that provides a relatively comprehensive set of features for software development. At a minimum, an IDE typically supports source-code editing, source control, build automation, and debugging.
However, the same can be achieved in code editors and also the modal text editors discussed later on. The difference is that for an IDE, everything comes as one package. You install one program and get all the good stuff with minimal additional setup. Let's take Pycharm for example, a popular Python IDE from Jetbrains, by default you get so many features such as git integration, debugging, an interpreter and support for library integrations such as Django. I think it even has Jupyter Notebook support.
There's an IDE for all the popular languages. Check out Awesome-IDEs
Code Editors
The most common text editor, by far is VS Code. Code editors are designed specifically for code editing and provide features for achieving that. They come with syntax highlighting by default and shortcuts for easily manipulating code.
What differentiates IDEs and Code editors is that, code editors are not really specialized on one programming language. You can setup your code editor to work with Python, Rust or C. For that reason, to achieve functionality such as code actions, you have to manually install plugins. These plugins provide Language Server Protocols. The plugins are not however just focused on Language support, there are plugins for so many things, including themes.
Code editors are mostly a little more lightweight than IDEs. It is still possible to bloat your code editor to the point that it's heavier than the IDEs themselves.
Text Editors
Text editors are convenient since they offer the perfect balance of control and simplicity.Some text editors are very simple and are only useful for making slight changes to files. GNU Nano is one classic example. It does provide syntax highlighting and a few shortcuts to perform quick actions.
There are other text editors that provide a way to extend their functionality.Vim, Neovim,Emacs and Helix are all examples of these kind of text editors.Emacs is too extensible to even be called a text editor, while Helix currently doesn't support plugins like Vim and Neovim (There are however plans to include one).
Modal Text Editors
A modal text editor has multiple modes of operation and the key's function change depending on which mode it is in. Helix is highly inspired by other modal text editors - Kakoune and Neovim.Kakoune was also inspired by Vim and as you might have already deciphered, Neovim is the "Neo" Vim :).
The key thing to note here is that there is a deep-seated relationship between these editors. However, you do not need to be familiar with the aforementioned editors to learn Helix. ( A familiarity with any of them will obviously make it easier to learn the other due to their overlapping functionality).
Why Helix And Not Vim/Neovim
One of the most popular modal text editors is Vim/ Neovim. Most people who are familiar with modal editing use Vim/Neovim.Even though vim is still actively maintained, most people have migrated to Neovim. Since helix took inspiration from Neovim, I'll be talking about Neovim. If I use the word vim, substitute it for Neovim.
Neovim is quite bare bones to begin with. To achieve most of the tasks you have to set-up a file explorer, language server, themes, fuzzy search and so much more. This means that for any new functionality you need, you will have to edit a lua file. If you love tinkering, and building your own editor from scratch, then Neovim might be for you. If that doesn't sound like you but you would still like to try out modal text editing, then Helix is the perfect editor for you.
There are also some Neovim distros such as LazyVim and NvChad. I have tried both of them and they are pretty solid and give you almost a complete setup for most of the basic stuff you will need. They have by default a package manager (lazy.nvim), allowing you to quickly install other plugins and extend your Neovim configuration as needed.
The baseline here is, to get a good working environment in Neovim, you will have to do some tinkering. Unlike Neovim, helix has most of the necessary features built-in. It has a fuzzy search, LSP support and themes all built-in. No setup required, and your editor just works. Now, don't get me wrong, you still might have to touch the config files to change a few things such as themes and the behaviour of LSPs but not quite as frequent as you have to in Neovim.
Helix uses TOML for configuration which is quite simple.
Helix Features
Helix boasts a wide array of features which will be discovered as you continue learning more about it. Some of the key features include:
-
Built-in Language Server Support
-
Multiple Selections
-
Smart Incremental syntax-highlighting
Installing Helix
To install helix, see the official installation instructions from the official helix website.For example, to install it on arch linux run the following command.
sudo pacman -S helix
To access the tutor, run the following command
hx --tutor
If you are on archlinux, you may have to use the full name:
helix --tutor
If you want to use the command hx, either create an alias or just create a symlink to the helix binary on a file named hx.
sudo ln -s /usr/bin/helix /usr/local/bin/hx
# /usr/local/bin/ should be in $PATH
The helix tutor covers the basics of modal editing and how to get started with helix. At the time of writing, helix claims that the tutorial is incomplete. However, the information contained there in is more than enough to get started.
The helix tutor covers topics such as:
- The basics of modal editing
- Performing motions and selections
- Common commands such as delete(
d) and change(c) - Text manipulation techniques such as copying, pasting, redo and undo
- Searching
- Working with Multiple cursors
- Find and till motions
- Working with registers and macros
- Match mode
- Creating splits
If you are already familiar with vim, you can skip the helix tutor. Check out migrating from Neovim or Vim. One key difference I can note is that in vim, the command comes before the selection such as dw to delete a word, while in Helix you would use wd. This gives some form of visual feedback on the text your are about to perform changes on.
Configuring Helix
Helix is configured via a config.toml file. The location on Unix based systems is ~/.config/helix/config.toml. On windows, the directory looks something like %AppData%\helix\config.toml. You can also just open the config right from helix without traversing directories manually by running the command :config-open within helix normal mode.
Look at this minimal config file:
theme = "github_dark"
[editor]
line-number = "relative"
soft-wrap.enable = true
mouse = false
[editor.cursor-shape]
insert = "block"
normal = "bar"
select = "underline"
You can easily figure out what each of those settings change. As mentioned before, helix uses TOML (Tom's Obvious Minimal Language) for configuration which is quite easy to grasp. This simple config sets guthub_dark as the preferred theme for the editor, sets up relative line numbers and enables soft wrap. It also sets up cursor shape in the different modes. Helix allows you to customize many parts of the editor, includig the statusline, the file picker among others. Check out the editor section configuration options from the official docs for a complete guide. Make sure to play around with the different settings and observe the changes.
Themes
Helix comes with over 100 themes by default. You can check them out by typing the command :theme a list of the themes will popup, somewhere on the bottom left. You can then tab over the themes to try them out temporarily. If you like a theme, you can then add it to your config by adding theme = "yourtheme" at the top level of your config.
You can also create your own themes. This can also be done by inheriting from the existing themes and tweaking specific parts to achieve your desired theme. For example, I used this feature to force helix to inherit the background opacity of my terminal (I love glazing at my wallpaper when working from the terminal 🙂).
To achieve that, create a folder named themes on the same level as the config.toml file. On unix based systems, this would be ~/.config/helix/themes and on Windows, this would be %AppData%\helix\themes. You can then create a theme in the folder, in my case I create a theme named transparent.toml, and add the following.
# My theme inherits the inbuilt bogster theme
inherits = "bogster"
# Set various sections' bg to none
# For example "ui.menu" configures the code and command completion menus
"ui.background" = { bg = "none" }
"ui.window" = { bg = "none" }
"ui.statusline" = { bg = "none" }
"ui.help" = { bg = "none" }
"ui.menu" = { bg = "none" }
"ui.popup" = { bg = "none" }
Language Server Protocol Support
Helix has language server support provided out of the box. Just install your LSP and helix will pick it up. For example for C language support, I installed clangd, and helix automatically provides code actions such as code completions and definitions. You can configure the language options in a languages.toml file located in the same location as the config.toml file, which overrides the default configuration provided by helix. You can also have configuration files local to a project by creating a .helix directory in the project root and then create a languages.toml there.For example, to enable both ruff and pyright support for the Python programming language, add the following in languages.toml
[[language]]
name = "python"
language-servers = [ "pyright", "ruff" ]
To install the Language servers, in archlinux I used:
sudo pacman -Syu pyright ruff clang
Please note that these might be different based on your Operating system. Make sure to find out how to install the LSPs for your system. Just install the LSP and it will work out of the box. The configuration is only needed to control the behaviour of the LSPs.
To check if the LSP is detected, you can run hx --health language. For example, check status for Python, hx --health python. With our current setup, the output would be something akin to:
Configured language servers:
✓ pyright: /usr/bin/pyright-langserver
✓ ruff: /usr/bin/ruff
Configured debug adapter: None
Configured formatter: None
Tree-sitter parser: ✓
Highlight queries: ✓
Textobject queries: ✓
Indent queries: ✓
Check out Language Configuration for more information.