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,
f
,F
,t
andT
are not confined to the current line.
Key | Description |
---|---|
h , Left | Move left |
j , Down | Move down |
k , Up | Move up |
l , Right | Move right |
w | Move next word start |
b | Move previous word start |
e | Move next word end |
W | Move next WORD start |
B | Move previous WORD start |
E | Move next WORD end |
t | Find till next char |
f | Find next char |
T | Find till previous char |
F | Find previous char |
G | Go to line number <n> |
Alt-. | Repeat last motion (f , t , m , [ or ] ) |
Home | Move to the start of the line |
End | Move to the end of the line |
Ctrl-b , PageUp | Move page up |
Ctrl-f , PageDown | Move page down |
Ctrl-u | Move cursor and page half page up |
Ctrl-d | Move cursor and page half page down |
Ctrl-i | Jump forward on the jumplist |
Ctrl-o | Jump backward on the jumplist |
Ctrl-s | Save the current selection to the jumplist |
Changes
Key | Description |
---|---|
r | Replace with a character |
R | Replace with yanked text |
~ | Switch case of the selected text |
` | Set the selected text to lower case |
Alt-` | Set the selected text to upper case |
i | Insert before selection |
a | Insert after selection (append) |
I | Insert at the start of the line |
A | Insert at the end of the line |
o | Open new line below selection |
O | Open new line above selection |
. | Repeat last insert |
u | Undo change |
U | Redo change |
Alt-u | Move backward in history |
Alt-U | Move forward in history |
y | Yank selection |
p | Paste after selection |
P | Paste before selection |
" <reg> | Select a register to yank to or paste from |
> | Indent selection |
< | Unindent selection |
= | Format selection (LSP) |
d | Delete selection |
Alt-d | Delete selection, without yanking |
c | Change selection (delete and enter insert mode) |
Alt-c | Change selection (delete and enter insert mode, without yanking) |
Ctrl-a | Increment object (number) under cursor |
Ctrl-x | Decrement object (number) under cursor |
Q | Start/stop macro recording to the selected register (experimental) |
q | Play back a recorded macro from the selected register (experimental) |
Shell
Key | Description |
---|---|
| | 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
Key | Description |
---|---|
s | Select all regex matches inside selections |
S | Split selection into sub selections on regex matches |
Alt-s | Split selection on newlines |
Alt-minus | Merge 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 |
C | Copy selection onto the next line (Add cursor below) |
Alt-C | Copy 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 |
x | Select current line, if already selected, extend to next line |
X | Extend selection to line bounds (line-wise selection) |
Alt-x | Shrink selection to line bounds (line-wise selection) |
J | Join lines inside selection |
Alt-J | Join lines inside selection and select the inserted space |
K | Keep selections matching the regex |
Alt-K | Remove selections matching the regex |
Ctrl-c | Comment/uncomment the selections |
Alt-o , Alt-up | Expand selection to parent syntax node (TS) |
Alt-i , Alt-down | Shrink syntax tree object selection (TS) |
Alt-p , Alt-left | Select previous sibling node in syntax tree (TS) |
Alt-n , Alt-right | Select next sibling node in syntax tree (TS) |
Alt-a | Select all sibling nodes in syntax tree (TS) |
Alt-I , Alt-Shift-down | Select all children nodes in syntax tree (TS) |
Alt-e | Move to end of parent node in syntax tree (TS) |
Alt-b | Move to start of parent node in syntax tree (TS) |
Search
Note
Search commands all operate on the
/
register by default. To use a different register, use"<char>
.
Key | Description |
---|---|
/ | Search for regex pattern |
? | Search for previous pattern |
n | Select next search match |
N | Select 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
Symbol | Usage |
---|---|
/ | 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 Sequence | Action |
---|---|
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
Prefix | Selection |
---|---|
ma | Around |
mi | Inside |
Suffix | Selection |
---|---|
w | Word |
W | WORD |
p | Paragraph |
( , [ , ' , etc. | Specified surround pairs |
m | The closest surround pair |
f | Function |
t | Type (or Class) |
a | Argument/parameter |
c | Comment |
T | Test |
g | Change |