For easy file editing, I’m currently trying out Helix, so editing is as simple as calling hx on the file.

I tried out Helix some time ago but didn’t find the ecosystem that appealing at that point. As the project matured some more, I found myself drawn to it again. It aims to be a no-nonsense approach to LSP and Tree-sitter integration, coming with sane defaults and batteries included out of the box.

Install

Homebrew

brew install helix

Snap

Note

You can add the option --edge, to use the latest/edge channel instead of the default latest/stable one.

sudo snap install helix --classic

Flatpak

sudo flatpak install flathub com.helix_editor.Helix
sudo flatpak run com.helix_editor.Helix

Fedora

Caution

Unfortunately, the Fedora package seems to be out of date currently, or at least significantly lacking behind development. Also, the Rust install from source isn’t as straightforward as some other packages, where you can simply invoke binstall. For these reasons, I recommend the Homebrew installation method, at least for now.

sudo dnf install helix

Usage

Info

This section is heavily inspired and/or copied from the official helix documentation. Therefore, please always refer to the upstream documentation. The only reason I replicate it is for easier referencing for myself, as a previous heavy Neovim user. I also highlight the rows differing significantly from normal VIM behaviour.

Movement

Note

Unlike Vim, fFt and T are not confined to the current line.

KeyDescription
hLeftMove left
jDownMove down
kUpMove up
lRightMove right
wMove next word start
bMove previous word start
eMove next word end
WMove next WORD start
BMove previous WORD start
EMove next WORD end
tFind till next char
fFind next char
TFind till previous char
FFind previous char
GGo to line number <n>
Alt-.Repeat last motion (ftm[ or ])
HomeMove to the start of the line
EndMove to the end of the line
Ctrl-bPageUpMove page up
Ctrl-fPageDownMove page down
Ctrl-uMove cursor and page half page up
Ctrl-dMove cursor and page half page down
Ctrl-iJump forward on the jumplist
Ctrl-oJump backward on the jumplist
Ctrl-sSave the current selection to the jumplist

Changes

KeyDescription
rReplace with a character
RReplace with yanked text
~Switch case of the selected text
`Set the selected text to lower case
Alt-`Set the selected text to upper case
iInsert before selection
aInsert after selection (append)
IInsert at the start of the line
AInsert at the end of the line
oOpen new line below selection
OOpen new line above selection
.Repeat last insert
uUndo change
URedo change
Alt-uMove backward in history
Alt-UMove forward in history
yYank selection
pPaste after selection
PPaste before selection
" <reg>Select a register to yank to or paste from
>Indent selection
<Unindent selection
=Format selection (LSP)
dDelete selection
Alt-dDelete selection, without yanking
cChange selection (delete and enter insert mode)
Alt-cChange selection (delete and enter insert mode, without yanking)
Ctrl-aIncrement object (number) under cursor
Ctrl-xDecrement object (number) under cursor
QStart/stop macro recording to the selected register (experimental)
qPlay back a recorded macro from the selected register (experimental)

Shell

KeyDescription
|Pipe each selection through shell command, replacing with output
Alt-|Pipe each selection into shell command, ignoring output
!Run shell command, inserting output before each selection
Alt-!Run shell command, appending output after each selection
$Pipe each selection into shell command, keep selections where command returned 0

Selection

KeyDescription
sSelect all regex matches inside selections
SSplit selection into sub selections on regex matches
Alt-sSplit selection on newlines
Alt-minusMerge selections
Alt-_Merge consecutive selections
&Align selection in columns
_Trim whitespace from the selection
;Collapse selection onto a single cursor
Alt-;Flip selection cursor and anchor
Alt-:Ensures the selection is in forward direction
,Keep only the primary selection
Alt-,Remove the primary selection
CCopy selection onto the next line (Add cursor below)
Alt-CCopy selection onto the previous line (Add cursor above)
(Rotate main selection backward
)Rotate main selection forward
Alt-(Rotate selection contents backward
Alt-)Rotate selection contents forward
%Select entire file
xSelect current line, if already selected, extend to next line
XExtend selection to line bounds (line-wise selection)
Alt-xShrink selection to line bounds (line-wise selection)
JJoin lines inside selection
Alt-JJoin lines inside selection and select the inserted space
KKeep selections matching the regex
Alt-KRemove selections matching the regex
Ctrl-cComment/uncomment the selections
Alt-oAlt-upExpand selection to parent syntax node (TS)
Alt-iAlt-downShrink syntax tree object selection (TS)
Alt-pAlt-leftSelect previous sibling node in syntax tree (TS)
Alt-nAlt-rightSelect next sibling node in syntax tree (TS)
Alt-aSelect all sibling nodes in syntax tree (TS)
Alt-IAlt-Shift-downSelect all children nodes in syntax tree (TS)
Alt-eMove to end of parent node in syntax tree (TS)
Alt-bMove to start of parent node in syntax tree (TS)

Note

Search commands all operate on the / register by default. To use a different register, use "<char>.

KeyDescription
/Search for regex pattern
?Search for previous pattern
nSelect next search match
NSelect previous search match
*Use current selection as the search pattern, automatically wrapping with \b on word boundaries
Alt-*Use current selection as the search pattern

Registers

SymbolUsage
/Last Search
:Last Command
"Last Yank
@Last Macro
_null / Trash
#[1-9]+Selection at index [1-9]+
.Current selections
%Current filename
+System clipboard
*Primary clipboard

Surround

Key SequenceAction
ms<char> (after selecting text)Add surround characters to selection
mr<char_to_replace><new_char>Replace the closest surround characters
md<char_to_delete>Delete the closest surround characters

Text Objects

PrefixSelection
maAround
miInside
SuffixSelection
wWord
WWORD
pParagraph
([', etc.Specified surround pairs
mThe closest surround pair
fFunction
tType (or Class)
aArgument/parameter
cComment
TTest
gChange