docs/src/config/keybindings.md

55 lines · 1620 bytes

 1# Keybindings config
 2
 3The keybindings config binds each key to an action, or multiple keys for the same action. It can be found in `~/.config/youtube-tui/keybindings.yml`.
 4
 5## Example keybindings config
 6
 7```yaml
 8Up:
 9  0: MoveUp
10Down:
11  0: MoveDown
12Right:
13  0: MoveRight
14Left:
15  0: MoveLeft
16  4: Back
17Esc:
18  0: Deselect
19Backspace:
20  0: Back
21Enter:
22  0: Select
23```
24
25## Keys
26
27Keys are the name of the keys that are pressed in the keyboard, all keys are avaliable <a href="https://docs.rs/crossterm/latest/crossterm/event/enum.KeyCode.html" target=_blank>*here*</a>.
28
29## Key modifiers
30
31Key modifiers are the modifier keys that are pressed along with the actual key, for instance in `Ctrl + C` would have the modifier `Ctrl` and the key `C`.
32
33Each modifier has its own code, for instance `Shift` would be `1` and `Ctrl` would be `2`. The final modifier will be the <u>sum</u> of all modifier keys. (`Ctrl + Shift` would be a `3`).
34
35### Keys reference
36
37All possible keys can be found <a href="https://docs.rs/crossterm/latest/crossterm/event/enum.KeyCode.html" target=_blank>*here*</a>.
38
39> Enums are represented using the character `!`, for example the `q` key would be `!Char 'q'`
40>
41> `Shift + Q` however would be `!Char 'Q'` with `0` as modifier code as `Shift` turns `q` into an upper case character.
42
43### Modifiers reference
44
45|Modifier|Code|
46|---|---|
47|None|`0`|
48|`Shift`|`1`|
49|`Ctrl`|`2`|
50|`Alt`|`4`|
51|`Super`/"Windows" key|`8`|
52|`Hyper`|`16`|
53|`Meta`|`32`|
54
55All key modifiers (if any are added) will be in <a href="https://docs.rs/crossterm/latest/crossterm/event/struct.KeyModifiers.html" target=_blank>*the code*</a>.