on febee2d help sign in
helix/book/src/remapping.md
57 lines 2.3 kB history raw
1# Key Remapping
3One-way key remapping is temporarily supported via a simple TOML configuration
4file. (More powerful solutions such as rebinding via commands will be
5available in the future).
7To remap keys, write a `config.toml` file in your `helix` configuration
8directory (default `~/.config/helix` in Linux systems) with a structure like
9this:
11```toml
12# At most one section each of 'keys.normal', 'keys.insert' and 'keys.select'
13[keys.normal]
14a = "move_char_left" # Maps the 'a' key to the move_char_left command
15w = "move_line_up" # Maps the 'w' key move_line_up
16"C-S-esc" = "extend_line" # Maps Control-Shift-Escape to extend_line
17g = { a = "code_action" } # Maps `ga` to show possible code actions
18"ret" = ["open_below", "normal_mode"] # Maps the enter key to open_below then re-enter normal mode
20[keys.insert]
21"A-x" = "normal_mode" # Maps Alt-X to enter normal mode
22j = { k = "normal_mode" } # Maps `jk` to exit insert mode
23```
25Control, Shift and Alt modifiers are encoded respectively with the prefixes
26`C-`, `S-` and `A-`. Special keys are encoded as follows:
28| Key name | Representation |
29| --- | --- |
30| Backspace | `"backspace"` |
31| Space | `"space"` |
32| Return/Enter | `"ret"` |
33| < | `"lt"` |
34| \> | `"gt"` |
35| \+ | `"plus"` |
36| \- | `"minus"` |
37| ; | `"semicolon"` |
38| % | `"percent"` |
39| Left | `"left"` |
40| Right | `"right"` |
41| Up | `"up"` |
42| Down | `"down"` |
43| Home | `"home"` |
44| End | `"end"` |
45| Page | `"pageup"` |
46| Page | `"pagedown"` |
47| Tab | `"tab"` |
48| Back | `"backtab"` |
49| Delete | `"del"` |
50| Insert | `"ins"` |
51| Null | `"null"` |
52| Escape | `"esc"` |
54Keys can be disabled by binding them to the `no_op` command.
56Commands can be found at [Keymap](https://docs.helix-editor.com/keymap.html) Commands.
57> Commands can also be found in the source code at [`helix-term/src/commands.rs`](https://github.com/helix-editor/helix/blob/master/helix-term/src/commands.rs) at the invocation of `commands!` macro.