Neovim vs Helix: Which is the best Vi/Vim style modal editor?

Last Updated on February 27, 2023 by David

Introduction

Neovim and Helix are both modal editors for programmers. They have a lot in common, but different approaches to providing the IDE (integrated development environment) features that make them so appealing.

IDE features make writing code easier and more productive. They include things like intelligent code completion and integration with the Git version control system. These features differentiate a program designed for writing code from a basic text editor.

This article will explain the main differences between these editors, as well as the pros and cons of each approach they take. Also, it will discuss their history, performance, and built-in features. There will be a conclusion regarding which editor is the best and why.

Development history

Neovim, released in 2015, is a fork of Vim. It is a refactor that aims to maintain backwards compatibility while also extending functionality. Recently it added LSP capabilities and the Lua scripting language to its core. Adding Lua allows for programming in a faster and superior language to Vimscript, resulting in a lot of great new plugins.

While Neovim is backwards compatible with Vim, it is in the process of diverging and heading in a new direction. The focus is now on expanding the integration of Lua, while Vim has instead created a new version of Vimscript for Vim 9

Helix is a much newer project and only came out in 2021. It is written from scratch in Rust and has no ambition to be backwards compatible with anything. Recently it has seen a lot of interest and gained a lot of new contributors. Currently, it has no plugin system, but one based on WebAssembly is being planned.

Using Modal editors

Modal editors have separate modes for writing and editing. In writing mode, usually called insert mode, keypresses work as you would expect with characters appearing on the screen. In editing mode, also known as normal mode, sequences of keypresses now perform advanced edits.

Different modes allow you to edit without a mouse, and, if you become an expert, you can theoretically write and edit ‘at the speed of thought.’

Downloading and installation

  1. Check the availability of pre-built packages for Helix and Neovim
  2. If you don’t have a recent version in your package manager then read how to install Neovim and how to install Helix

With Neovim you have a choice of using the latest nightly or stable release. Nightlies are the latest version automatically compiled from the source code every day. While they have newer features, they may have bugs as they have not been fully tested.

Currently, there is no nightly for Helix, and a lot of new features and bug fixes are being added between stable releases. This means the only way to get the latest version is to install it from source using the Rust toolchain. This is a big negative, but nightlies are being worked on.

A Helix install script for Linux that builds from source

The following bash script will install Helix from source and create your config file for you. It sets the theme to dark_plus (VS Code), the escape keys to be jk, and a few extra settings you may or may not want to use.

  1. Check that you have Rust installed
  2. Save the script and make sure it is executable with chmod +x [filename]
  3. Run it, make note of the instructions on how to update at the end
#!/bin/bash
set -e                                # quit on error
SOURCE_DIR=~/src/helix                # directory to store helix source, user changeable
CONFIG_DIR=~/.config/helix            # default, don't change
CONFIG_FILE="$CONFIG_DIR/config.toml" # default, don't change

mkdir -p $SOURCE_DIR
git clone https://github.com/helix-editor/helix $SOURCE_DIR
cd $SOURCE_DIR || exit
cargo install --locked --path helix-term

mkdir -p $CONFIG_DIR
cd $CONFIG_DIR || exit
[ ! -e ./runtime ] && ln -s $SOURCE_DIR/runtime . # create a symlink to the source directory

if [ ! -f $CONFIG_FILE ]; then
    cat >$CONFIG_FILE <<EOF
theme = "dark_plus"

[keys.normal]
G = "goto_file_end" # vim
Z = { Z = ":wq", Q = ":q!" } # vim, save and quit, quit without saving
"#" = "toggle_comments"
C-s = ":w"

[keys.insert]
j = { k = "normal_mode" }
C-s = ":w"

[keys.select]
G = "goto_file_end" # vim

[editor.cursor-shape]
insert = "bar" # change cursor shape in insert mode

[editor.file-picker]
hidden = false # don't ignore hidden files
EOF
    echo "
    $CONFIG_FILE created"
else
    echo "
    $CONFIG_FILE exists, skipping creating new one"
fi

echo "
Helix is installed and compiled from source!

- Don't delete the source directory: $SOURCE_DIR
- Make configuration changes in: $CONFIG_DIR/config.toml
- Update with:

cd $SOURCE_DIR
git pull
cargo install --path helix-term
"

Here is my languages.toml file in case you want to use any of my settings. It assumes a global install of prettier, shfmt, deno and rust

[[language]]
name = "html"
formatter = { command = 'prettier', args = ["--parser", "html"] }

[[language]]
name = "css"
formatter = { command = 'prettier', args = ["--parser", "css"] }
auto-format = true

[[language]]
name = "markdown"
formatter = { command = 'prettier', args = ["--parser", "markdown"] }
auto-format = true

[[language]]
name = "bash"
formatter = { command = 'shfmt', args = ["-i", "4"] }
auto-format = true

[[language]]
name="rust"
[language.config]
checkOnSave = {command = "clippy"}

[[language]]
name = "json"
formatter = { command = 'deno', args = ["fmt", "-", "--ext", "json" ] }

[[language]]
name = "javascript"
formatter = { command = 'deno', args = ["fmt", "-", "--ext", "js" ] }
auto-format = true

[[language]]
name = "typescript"
formatter = { command = 'deno', args = ["fmt", "-", "--ext", "ts" ] }
auto-format = true

[[language]]
name = "jsx"
formatter = { command = 'deno', args = ["fmt", "-", "--ext", "jsx" ] }
auto-format = true

[[language]]
name = "tsx"
formatter = { command = 'deno', args = ["fmt", "-", "--ext", "tsx" ] }
auto-format = true

The two main differences between Neovim and Helix

Both editors are similar in many ways, but two big differences set them apart.

Keyboard shortcuts: Neovim uses Vim shortcuts, Helix uses a mix of Kakoune and Vim shortcuts

Neovim uses all the traditional Vim keyboard shortcuts, but Helix takes a hybrid approach and combines Vim and Kakoune shortcuts.

Kakoune uses the selection → action model. This means that whatever you are going to act on (a word, a paragraph, a line etc.) is selected first and the action itself (delete, change, yank etc.) comes second. This may come as a shock to Vim users who have had years of practice using the traditional Vim approach.

The Kakoune approach is superior in many ways, particularly for newcomers. As selections are highlighted it makes learning a lot easier. The big downside is that not many people are used to it.

Helix user workingj has kindly prepared a printable PDF cheat sheet of all the Helix keyboard shortcuts to help you get used to them.

Built-in features: Helix has IDE features built in, Neovim leaves them to plugins

The main difference between the two editors are which features are included by default.

Neovim provides a framework for Lua developers to build their own plugins that can provide IDE features. Helix takes the opposite approach and tries to provide every mainstream feature you need out of the box.

Helix plans to have plugins in the future, but only time will tell how many and how good they are.

If you would like to use Neovim without any plugins then please have a look at Neovim Explained: How to Build a Plugin-Free Nvim Config That Unlocks Builtin Features

Helix’s built-in IDE features

  • Fuzzy file picker
  • Autocompletion
  • Comment toggling
  • DAP debugger
  • Multiple cursors
  • Which-key style info box
  • Vim-surround style commands
  • LSP (setup out of the box)
  • Diagnostics picker
  • Format using choice of LSP or CLI utility

Coming soon:

All this functionality can be added to Neovim as plugins, but if you like how these features are implemented in Helix then you will be happy to not need a plugin.

Neovim’s important features that Helix lacks

While Neovim lacks IDE features, it does have some important commonly used features that Helix lacks built in:

  • Soft wrapping
  • Code folding
  • File watching

Also, while not built-in, it has more working language servers using the nvim-lspconfig plugin (for example Deno for JavaScript/TypeScript and ltex-ls for spelling and grammar). This is because Neovim can provide extended features to the language servers that are not built into the language server specification.

The Pros and cons of built-in IDE features

Many users find setting up Neovim plugins difficult and time-consuming. Others love spending hours choosing plugins and customizing their setup. I imagine the majority of users would prefer a good balance between having features built in and the option to customize if needed.

Pros:

  • No extra plugins are needed, no time is wasted researching or configuring them
  • Centralized integration and support of all features
  • No plugins that become broken due to editor updates

Cons:

  • No alternatives to the built-in features
  • No plugin competition could lead to a lack of innovation in that feature
  • Unwanted features are ‘bloat’

Performance

Many people move from VS Code to terminal-based modal editors for increased performance. Neovim and Helix are both written in compiled languages and are an order of magnitude faster and more responsive.

Helix seems slightly faster, but there is not any real difference to be concerned with. Both are extremely snappy.

Conclusion

Neovim is a great editor, its vast plugin ecosystem providing many advanced and diverse extensions with features that Helix won’t have for a long time, if ever. It is very popular and has a wide user base. Its backwards compatibility with Vim is a big strength, but also a weakness. It is tied to a legacy code base and will forever be building on top of Vim rather than creating something fresh.

Helix is getting everything right. It has created genuine competition to Neovim in a short space of time. While some users may be unwilling to switch to its new shortcuts, others will rejoice at all the built-in features and lack of legacy baggage. Most users will want the built-in features, and providing they are as good as the Neovim plugin equivalents then the majority of people will prefer the convenience of using them.

Reinventing the wheel again and again is a waste of time. Neovim needs at least to get basic features like commenting built in. Endlessly comparing plugins and searching for support on multiple GitHub accounts is boring and frustrating for many users.

If you are new to modal editing I would suggest you try Helix first and see how you get on. It is still young and has a lot of things that need adding, but the pace of development is fast. If you are a hardcore Vim keys user you might want to stay with an editor that sticks to those exact keybindings. Also, if you reply on a certain Neovim plugin that has no equivalent in Helix you will want to stick with Neovim.

It is an exciting time for modal editors as they are experiencing a genuine renaissance. Both of these editors are fantastic, which is ‘best’ depends on your personal requirements.

Did you enjoy this article?


Donate Monero 48iK49iM8pEbeNm9FEHaLj2rt7XxqtukvZg2yv5UbCWCTFEsw7175Dt6DFMkZrxS3C6qSJTJKECHW2tBZKyTLa1cRPWRPLT


If you would like me to write similar articles for you or your company please don’t hesitate to get in contact.

New posts (please add comments below)

Neovim vs Helix: Which is the best Vi/Vim style modal editor?

Last Updated on February 27, 2023 by David Introduction Neovim and Helix are both modal editors for programmers. They have a lot in common, but different approaches to providing the IDE (integrated development environment) features that make them so appealing. IDE features make writing code easier and more productive. They include things like intelligent code […]

Ultimate Vim Keyboard Shortcuts

Last Updated on July 27, 2022 by David A well-thought-out printable PDF of Vim keyboard shortcuts to enhance your workflow. I hope you find some cool ones you didn’t know about, and also find it a useful reference to the essentials. These shortcuts are all available out of the box in Vim and Neovim. If […]

Linux one-liners: Using the standard Find command to replace 3rd party fuzzy finders

Last Updated on May 18, 2022 by David When trying to solve a problem using Linux you can rest assured that someone has come across it before, and probably solved it back in the seventies. Everyone needs to search their hard drive for files and open them in a program of their choice. Using a […]

Neovim Explained: How to Build a Plugin-Free Nvim Config That Unlocks Builtin Features

Last Updated on May 18, 2023 by David Neovim (aka Nvim) is a radical refactor of Vim. It aims to take Vim, improve the code, and add more features. They are mostly compatible but have slightly different defaults. The settings in this Neovim tutorial should also work with the latest Vim. Neovim is a text […]

CentOS 8 Setup for Developers

Last Updated on April 26, 2022 by David CentOS 8 is a free version of RHEL 8 which was branched from Fedora 28. I consider this new version of CentOS to be the first viable long term support version of Fedora. In this article, I will discuss why CentOS 8 is amazing for developers, and […]

3 Comments

  1. I was using vi in the early eighties, switched to vim and decided to go all out for Helix this year. Helix for me was difficult after having to train my brain again. Now its so much better, faster and only a few lines of config. I wont go back to vim/neovim.

Leave a Reply

Your email address will not be published. Required fields are marked *