on master help sign in
doc: expand documentation on configuring minor modes
9530fabClément Delafargue
book/src/keymap.md+3
@@ -166,6 +166,9 @@ These sub-modes are accessible from normal mode and typically switch back to nor
166| `Ctrl-w` | Enter [window mode](#window-mode) | N/A |
166| `Ctrl-w` | Enter [window mode](#window-mode) | N/A |
167| `Space` | Enter [space mode](#space-mode) | N/A |
167| `Space` | Enter [space mode](#space-mode) | N/A |
168
168
169+These modes (except command mode) can be configured by
170+[remapping keys](https://docs.helix-editor.com/remapping.html#minor-modes).
171+
169#### View mode
172#### View mode
170
173
171Accessed by typing `z` in [normal mode](#normal-mode).
174Accessed by typing `z` in [normal mode](#normal-mode).
book/src/remapping.md+25−2
@@ -25,8 +25,31 @@ j = { k = "normal_mode" } # Maps `jk` to exit insert mode
25```
25```
26> NOTE: Typable commands can also be remapped, remember to keep the `:` prefix to indicate it's a typable command.
26> NOTE: Typable commands can also be remapped, remember to keep the `:` prefix to indicate it's a typable command.
27
27
28−> NOTE: Bindings can be nested, to create (or edit) minor modes: `g = { a = "code_action"}` adds a new entry to
28+## Minor modes
29−> the `goto` mode.
29+
30+Minor modes are accessed by pressing a key (usually from normal mode), giving access to dedicated bindings. Bindings
31+can be modified or added by nesting definitions.
32+
33+```toml
34+[keys.insert.j]
35+k = "normal_mode" # Maps `jk` to exit insert mode
36+
37+[keys.normal.g]
38+a = "code_action" # Maps `ga` to show possible code actions
39+
40+# invert `j` and `k` in view mode
41+[keys.normal.z]
42+j = "scroll_up"
43+k = "scroll_down"
44+
45+# create a new minor mode bound to `+`
46+[keys.normal."+"]
47+m = ":run-shell-command make"
48+c = ":run-shell-command cargo build"
49+t = ":run-shell-command cargo test"
50+```
51+
52+## Special keys and modifiers
30
53
31Ctrl, Shift and Alt modifiers are encoded respectively with the prefixes
54Ctrl, Shift and Alt modifiers are encoded respectively with the prefixes
32`C-`, `S-` and `A-`. Special keys are encoded as follows:
55`C-`, `S-` and `A-`. Special keys are encoded as follows: