Helix the revisiting

/media/images/helix_2024-03-03_09-12.png /media/images/helix_2024-03-03_09-13.png

Since my last post in July I've made the jump to helix as my primary editor for code. They still haven't addressed most of the things that bothered me last year but I've been writing more rust code and the rust-analyzer support in helix is just better than neovim.

Unfortunately it took hours to get this working. As it turned out:

helix --health

lies. It told me I was all good to go but rust-analyzer wasn't actually installed. I still needed to run:

rustup component add rust-analyzer

On my main system I also needed to remove an old version of rust-analyzer that was in my ~/.local/bin/ (found with 'which rust-analyzer' and 'rustup which rust-analyzer').

Before I discovered the missing rust-analyzer I went through every configuration option to make sure I didn't miss an enable switch and I revisited my theme to make sure it was working but the text wasn't visible. There was also conflicting information on whether I needed to add stuff to the language.toml file. The changes I'd made were for older versions of helix and were no longer necessary. You can see my final helix configuration in my dotfiles repo here.)

Now I'm attempting to train my fingers to use this new editor. My config.toml file has the list of aliases I'm trying to remember:

# na's muscle memory
# https://cheatography.com/hiddenmonkey/cheat-sheets/helix/
# https://github.com/helix-editor/helix/wiki/Migrating-from-Vim
# x selects the current line - delete it with xd
# d deletes the current character
# :e                            # use :o
# reload from disk with :reload
# *                             # be*n  (or preferably Alt+o*n)
# \c                            # use Ctrl+c
# m is now a jumplist           # use Ctrl+s to save and Ctrl+o to return, space+j to view
# :%s/word/replacement/g<ret>   # use %sword<ret>creplacement<esc>
# %                             # use mm instead!
#  0 = "goto_line_start"        # use gh instead!
#  "$" = "goto_line_end"        # use gl instead!
#  G = "goto_file_end"          # use ge instead!
# ,1 = goto_last_accessed_file  # use ga or (Space Space) instead
# can't toggle a render so use two buttons
# can't toggle gutter contents
# can't toggle soft-wrap see languages.toml
# V (select whole line)        # use xv to get started
# :reg                         # not possible https://www.reddit.com/r/HelixEditor/comments/130gbzy/is_it_possible_to_cycle_through_the_yank_history/?rdt=40070
# Y                            # use :clipboard-yank (or Space y)
# Ctrl+r  (redo)               # use U
# autocomplete                 # Ctrl+x
# q  and `                     # Q and q

# new stuff (multicursor)
# C - duplicate cursor down
# s - select - duplicate cursor horizontally
# ,, - cancel multiple cursors
# & - align vertical cursors
# Alt-s - select all endlines in a block
# S - split on a regex pattern
# Alt+; - put cursor on other end of selection
# ; - drop selection but keep cursors
#
# R - replace a selected word with the contents of the paste buffer
# ms( - add paranthesis around selection
# md( - remove paranthesis from within

I've found the main pain points are 'x', 'd', and 's'.

  • 'x' used to be delete the character under the cursor, now it means select the entire line
  • 'd' now means delete a selection or a single character under the cursor
  • 's' used to mean delete and go into insert mode (to replace a selection) now it means start a search in 'selection' mode for the multicursor.

What this means is that 50+ times a day I type 'dd' to remove a line and discover it only removed two characters. Or I type 'x' to remove a character and have to stop because now the entire line is highlighted. Or I select some text and hit 's' to change it and enter a restricted selection mode.

Just now, typing that last paragraph, I literally made these mistakes six times. Extrapolate that to all the typing I did today and you can imagine the frustration.


Stuff I like

  • It feels faster and less bloated than neovim.
  • The popup menus are fast and filled with useful information.
  • The type hinting, git integration, LSP help, and other file status stuff is appreciated.
  • My config file is practically empty, meaning they've chosen good defaults (and they aren't trying to support multiple configuration languages).
  • The integration with the system clipboard isn't insane.
  • I like the FZF file pickers.
  • The kakoune inspired keymap is more consistent than vim.
  • I like that the developers are taking a thoughful approach towards adding new features. It seems like the project, despite the slow progress, is unlikely to be abandoned or go off the rails.

Stuff I don't like

  • They don't have a spellchecker. This is critical for something I use for all my writing. One of the main devs recently changed his mind and decided a spellchecker should be a core feature but that the existing spellcheckers are all inadequate so they're starting a new rust project that will work with the existing hunspell dictionaries.
  • They don't have a plugin system. They're working on it but it's unclear when it will be available. A plugin system would allow users to go nuts. If helix had a plugin system we would have six different ghetto spellcheckers within a week. As it's looking now, we won't have this for a few years.
  • They don't have the option to run a diff between buffers. This is something I do often and I'm not looking forward to jumping back and forth between editors or running some other app to do my diffs.

Still it seems like the editor has some momentum. They recently added a pipe command and I've been seeing helix users abusing it to do unspeakable things like adding copilot support. And the vifm guys have instructions on how to integrate the file picker into a tmux-helix install using some frightening tmux configuration hacks.

I still use vim for my git commits (and apparently for spellcheck) and I can already tell my muscle memory is soon going to have the opposite problem and I'll start making helix mistakes in neovim. The perils of switching text editors are fraught.