Helix - Preconfigured Neovim alternative
Investigation time
Helix has been on my mind for a long time, but I never got around to it. It is time to fix that.
I’m doing this comparison between Helix and Neovim, which has been my editor of choice for a long time.
This document is WIP, so it might not be completely factually correct. I’m writing this while learning.
Should you?
Yes, even if you are a hardcore Vimmer I think you should try Helix.
If for nothing else, then to learn about other tools or plugins to use with Neovim. I find it less demanding to read Helix docs than to modify my own or fetch a preconfigure Neovim config for testing.
You might not know what you’re missing if you haven’t found it yet.
Initial feelings
Really impressive out-of-the-box experience. My config is only three lines consisting of theme, relative line numbers, and fish shell config. I think this is enough to feel pretty comparable to nvim. Not having to worry about plugin versions or configs sounds really nice.
I tend to be a bit lazy with adding plugins to my Neovim/Kickstart config so something like Helix instantly fixes this issue for me.
It includes things like file picker, jump to two-character label to move around, surround selection or clear surround, show possible actions.
Movement and action
Getting used to the selection -> action paradigm was surprisingly easy after some RTFM and few days of using Helix.
There is also :tutor command, which lays out the basics and which I haven’t even read fully. I’m sure there is much more to learn.
What I’m missing
While being impressive, Helix does have some tradeoffs compared to Neovim as far I can tell.
- No way to select inside. One of my favorite things about vim bindings is being able to easily select, replace and delete inside quotes, parenthesis, brackets, etc.
- There is work being done to solve this: Issue #11695. Hopefully it can be completed.
- Searching for a solution, there is
mi", but this only works from inside the pair block. Quite close, but my muscle memory doesn’t agree.
- Limited commands/scripting. One of Vim’s greatest assets for me is the possibility to use it as a scripting language and being able to craft somewhat complex commands quickly.
- No proper plugin system. I don’t see this a major issue because the editor is good enough as is, but this means that customization and niche tool support isn’t as good.
- No terminal support. This is something that I miss compared to nvim, it is nice to use editor native splits and tabs, and being able to move and select things within the same context.
- Vim bindings are supported pretty much everywhere, though as I understand Helix is making progress in this regard.
Cheat sheet
Some things that I wanted to know at the start.
- Rename a variable -
<space>r - File picker -
<space>f - Global find -
<space>/ - Go to end of file -
ge - Go to end of the line -
gl - Go to first non-empty character of the line -
gs - Clear selection -
; - Collapse multiple cursors -
, - Yank to system clipboard -
<space>y - Select all -
%
Replace all instances of a word
% s original <ret> c replace <esc> ,
- Select the whole buffer with
% - Init select with
s - Type the word or regex pattern to replace and press enter
- Replace for all cursors with
c - Return to normal mode with esc
- Collapse cursors with
,
Replace single instances of a word
/ original <esc> c replace <esc> then n to move to next instance and . to replace it.
- Init search with
/. You can move to nextnor previousNinstances instead of replacing the first instance. - Type the word or regex pattern to replace
- Exit to normal mode with escape
- Replace for all cursors with
c - Return to normal mode with esc
- Use
n/Nto move between other instances and replace by retrying the replace action with.
Conclusion
I think this is pretty well understood, but Helix offers an awesome editor with minimal setup and comparable workflow to nvim while sacrificing customizability and some power.
Being able to just install and be ready to go is valuable and desirable. Not having to download and execute code from multiple sources is also a plus for me. I can get everything that I need from pacman, mainly Helix and the necessary language servers.
This is not the end of this story.