Helix crib sheet

This is a select subset of useful Helix text editor keys and commands for my own reference. For the exhaustive list see the official keymap page. Beginners should note that you can open the Helix tutorial file by calling hx --tutor from the command line.

Important note: Helix key bindings are case sensitive. Be careful to spot the difference between lowercase and Uppercase characters in this crib sheet. Also be aware that if you enable Caps Lock on your keyboard and then forget to turn it off, then Helix will assume you are pressing the uppercase key bindings, which can make a real mess of your document if that's not what you intended.

Global

Esc
Return to Normal mode (from anywhere)

You will be hitting the Esc key frequently, so if possible use a keyboard which puts the Esc key in a comfortable position, such as the Kinesis Advantage360 (which I'm using), or a configurable keyboard which lets you place the keys where you want them, such as the ZSA ErgoDox EZ (which I've never used).

Normal mode

Fundamentals

When you're not typing, then you'll spend most of your time in Normal mode.

i
Enter Insert mode (allows typing), with cursor(s) placed before selection(s)
a
Place cursor(s) after selection(s), then enter Insert mode ("append")
I
Place cursor(s) at start of line(s), then enter Insert mode
A
Place cursor(s) at end of line(s), then enter Insert mode
o
Create a blank line below primary selection, then enter Insert mode (gets a bit funky with multiple cursors)
O
Create a blank line above primary selection, then enter Insert mode (gets a bit funky with multiple cursors)
:
Enter Command mode
u
Undo last change (you can do this multiple times to undo multiple recent changes)
U
Redo last undone change (you can do this multiple times to restore multiple undone changes)

Movement

The cursor is where text will appear when typing in Insert mode. You can move the cursor (or multiple cursors) in the same way in both Normal mode and Select mode, but in Select mode the selection continues to grow or shrink based on the cursor movements, whereas in Normal mode cursor movements will reset the selection each time.

h
Move cursor(s) left ("hop back")
l
Move cursor(s) right ("leap forward")
j
Move cursor(s) down ("jump down")
k
Move cursor(s) up ("kick up")
<num> then G
Discard all but primary cursor and move it to line <num>
Ctrl + b
Scrolls view up one page and moves primary cursor (leaves other cursors/selections where they were)
Ctrl + f
Scrolls view down one page and moves primary cursor (leaves other cursors/selections where they were)
Ctrl + u
Scrolls view and moves cursor(s) half a page up (merges cursors that end up in the same position)
Ctrl + d
Scrolls view and moves cursor(s) half a page down (merges cursors that end up in the same position)

Selection

A cursor has a width of exactly one character, but you can create a selection on one side of the cursor to cover more characters. Remember that in Select mode the selection (or multiple selections) continues to grow or shrink based on the cursor movements, whereas in Normal mode cursor movements will reset the selection each time.

x
Select the current/next line (note: this is additive even in Normal mode)
X
Select the current line only (never additive; useful for selecting a blank line)
w
Select up to start of next word
e
Select to end of current/next word
b
Select to start of current/previous word
W
Select up to start of next word (considers all non-whitespace characters part of word)
E
Select to end of current/next word (considers non-whitespace characters)
B
Select to start of current/previous word (considers non-whitespace characters)
v
Enter Select mode (cursor movement grows/shrinks text selection)
t then <char>
Select up to <char> ("'til")
T then <char>
Select up to previous <char>
f then <char>
Select to <char> inclusive ("find")
F then <char>
Select to previous <char> inclusive
Alt + .
Repeat last motion (caused by f, t, m, [, ])
%
Select entire text of the current buffer
;
Keep cursor(s) but discard selection(s) ("semicolon shrinks selections")
Alt + ;
Swap cursor(s) to opposite end of selection(s)

Searching the current buffer

Hitting / lets you type in a regex (regular expression) and move the primary selection to the next sequence, in the current buffer, which matches that regex. You can hit Enter to confirm the move, or hit Esc to cancel the move. If multiple cursors/selections exist, only the primary selection will be moved to the matching sequence, and the other cursors/selections will remain where they are. Also note that a confirmed move adds the regex to the / register by default (but you can choose a different register).

If in Select mode, a new selection (and cursor) will be created around the matching text if you confirm the move, allowing you to add an additional selection (or multiple new selections).

/
Regex search within the current buffer (moves primary cursor only)
n
Jump to next match (creates new selection if in Select mode)
N
Jump to previous match (creates new selection if in Select mode)

Searching inside selections

Hitting s lets you type in a regex (regular expression) which will be used to search for matching text within all of your current selections. If you hit Enter to confirm the new selections then your previous selections will be discarded and instead you will have selections for all matching text within the old selections. Or you can hit Esc to cancel the new selections, and your previous selections will be restored. Also note that confirmation will add the regex to the / register by default (but you can choose a different register).

Note that you can use % then s to select all matching text within the entire buffer. This is the way to do a whole-document find-and-replace in Helix.

s
Select all text matching regex within current selection(s)

Multiple cursors/selections

Cloning the cursor, or using regex searches, can lead to multiple cursors (and selections) existing at the same time. Before taking bold actions, check the bottom-right of the Helix window to check for "1 sel" (one cursor/selection exists) because a higher number means that you have multiple cursors/selections.

Be aware that some themes in Helix do not make it possible to visually determine which is the primary cursor, so choose carefully. (I use the catppuccin_mocha theme.)

C
Clone cursor into same column below in next line which is long enough
,
Discard all cursors/selections except primary one ("comma clears cursors")
Alt + ,
Discard primary cursor/selection (has no effect if there is only one)
( or )
Cycle primary cursor between selections (forwards or backwards)
Alt + ( or Alt + )
Rotate text through selections (forwards or backwards)

Yank (cut, copy, paste)

Copying, deleting, and changing selected text will "yank" that text into a target register (default "). Think of each register as a labelled clipboard. Multiple cursors will remember their own yanked text, but if you discard all other cursors then the register will only offer the first-found text, regardless of primary cursor. Helix uses default registers for certain actions, but you can arbitrarily choose or create a new register by opening the Registers menu and hitting a character of your choice.

y
Yank (copy) text from current selection(s) into target register
p
Paste, after selection(s), text from target register
P
Paste, before selection(s), text from target register
d
Delete (cut) text in current selection(s) and yank deleted text into target register
Alt + d
Delete text in selection(s) without yanking the deleted text
c
Delete and yank text from selection(s) and enter Insert mode ("change")
R
Replace selection(s) with text from the target register (does not yank old text into register)

Adjustments

There are numerous actions you can perform on your selection(s) which do not involve registers. These actions do not read from or write to any registers.

r then <char>
Replace all characters in selection(s) with <char>
~
Toggle case (uppercase/lowercase) of every character in selection(s)
`
Set text in selection(s) to lowercase
Alt + `
Set text in selection(s) to uppercase
Ctrl + a
Increment purely numeric selection(s)
Ctrl + x
Decrement purely numeric selection(s)
>
Indent selected lines
<
Unindent selected lines
=
Format selected lines (requires LSP support)

: Command mode

Open from Normal mode by hitting :. In Command mode you will see a cursor appear on the very bottom line of the Helix terminal, positioned after a colon character. Helix has a very helpful command browser, which lets you start typing part of a command to see potential matches, and then hit Tab to cycle through them, and then hit Enter to execute the highlighted command. It also shows a tooltip to say what the highlighted command will do. Hit Esc to return to Normal mode without taking any action. When you execute a command it will be written to the : register.

There are many commands built into Helix, but here are the most important ones that you should know about.

q
Quit Helix (shows error if unsaved changes exist)
q!
Force-quit Helix (even if unsaved changes exist)
w
Save changes to the current buffer
w <filepath_and_name>
Save this buffer under the given path and name
theme
Shows theme name (hit Enter), or lets you type in/browse available themes (hit Space then Tab)
buffer-close
Close the current buffer (shows error if unsaved changes exist; opens a scratch buffer if no other buffers are open)
buffer-close!
Force-close the current buffer (even if unsaved changes exist; opens a scratch buffer if no other buffers are open)
reload
Discard changes and reload the current buffer from the underlying file, (does not warn about unsaved changes!)
reload-all
Discard changes and reload all buffers (does not warn about unsaved changes!)
o <filepath_and_name>
Opens the file under the given path and name (path does not have to be within current project directory tree)
move <filepath_and_name>
Moves the current buffer and its underlying file to the given path and filename

i Insert mode

Open from Normal mode by hitting i. In Insert mode most keys simply cause text to be added to the buffer, at the current position of the cursor (or multiple cursors). But there are a few keys and combinations which have non-typing effects.

Esc
Exit Insert mode and return to Normal mode
Ctrl + s
Commits an undo checkpoint (I'm not certain what this does)
Ctrl + x
Autocomplete (requires LSP)
Alt + Backspace
Delete previous word
Alt + Delete
Delete next word
Ctrl + u
Delete to start of line
Ctrl + k
Delete to end of line