on master help sign in
Update book to include typable command remapping (#1240)
a1e6481Oskar Nehlin
book/src/remapping.md+4−1
@@ -11,6 +11,8 @@ this:
11```toml
11```toml
12# At most one section each of 'keys.normal', 'keys.insert' and 'keys.select'
12# At most one section each of 'keys.normal', 'keys.insert' and 'keys.select'
13[keys.normal]
13[keys.normal]
14+C-s = ":w" # Maps the Control-s to the typable command :w which is an alias for :write (save file)
15+C-o = ":open ~/.config/helix/config.toml" # Maps the Control-o to opening of the helix config file
14a = "move_char_left" # Maps the 'a' key to the move_char_left command
16a = "move_char_left" # Maps the 'a' key to the move_char_left command
15w = "move_line_up" # Maps the 'w' key move_line_up
17w = "move_line_up" # Maps the 'w' key move_line_up
16"C-S-esc" = "extend_line" # Maps Control-Shift-Escape to extend_line
18"C-S-esc" = "extend_line" # Maps Control-Shift-Escape to extend_line
@@ -21,6 +23,7 @@ g = { a = "code_action" } # Maps `ga` to show possible code actions
21"A-x" = "normal_mode" # Maps Alt-X to enter normal mode
23"A-x" = "normal_mode" # Maps Alt-X to enter normal mode
22j = { k = "normal_mode" } # Maps `jk` to exit insert mode
24j = { k = "normal_mode" } # Maps `jk` to exit insert mode
23```
25```
26+> NOTE: Typable commands can also be remapped, remember to keep the `:` prefix to indicate it's a typable command.
24
27
25Control, Shift and Alt modifiers are encoded respectively with the prefixes
28Control, Shift and Alt modifiers are encoded respectively with the prefixes
26`C-`, `S-` and `A-`. Special keys are encoded as follows:
29`C-`, `S-` and `A-`. Special keys are encoded as follows:
@@ -53,4 +56,4 @@ Control, Shift and Alt modifiers are encoded respectively with the prefixes
53Keys can be disabled by binding them to the `no_op` command.
56Keys can be disabled by binding them to the `no_op` command.
54
57
55Commands can be found at [Keymap](https://docs.helix-editor.com/keymap.html) Commands.
58Commands can be found at [Keymap](https://docs.helix-editor.com/keymap.html) Commands.
56−> 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.
59+> 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 `static_commands!` macro and the `TypableCommandList`.