Step 5 of 5

Remapping keys

Remapping keys

The same file holds your key remaps. Each mode gets its own section — [keys.normal], [keys.insert], [keys.select] — and each line maps a key to a command name:

[keys.normal]
C-s = ":w"

A key can also open a nested table, which turns it into a prefix. This is how you get the classic jk to leave insert mode:

[keys.insert]
j = { k = "normal_mode" }

Helix waits after j to see whether k follows; anything else inserts the j as usual.

Two kinds of command can go on the right-hand side. Anything you can type at the prompt works, written with its colon (":w"). Bare names like normal_mode or extend_line are the editor commands that keys are bound to out of the box; the Helix keymap documentation lists every one.

Work through the checklist below to add the jk map and prove it works.

  1. Open your config with :config-open Type :config-open and hit Enter.
  2. Add a [keys.insert] section mapping jk to normal_mode Press ge, open a line below with o, type the two lines shown above, hit Escape, then press x to select the last line.
  3. Save it with :w Type :w and hit Enter.
  4. Reload, then leave insert mode with jk Type :config-reload and hit Enter, then press i and type jk — you're back in normal mode without touching Escape.
Open your config with :config-open Type :config-open and hit Enter.

Next: Add a [keys.insert] section mapping jk to normal_mode

Loading editor…