docs/src/config/keybindings.md

77 lines · 1770 bytes

7 symbols in this file
 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
 8'q':
 9  0: Exit
10Down:
11  0: MoveDown
12'r':
13  2: Reload
14Enter:
15  0: Select
16'l':
17  0: MoveRight
18Up:
19  0: MoveUp
20'j':
21  0: MoveDown
22End:
23  0: ClearHistory
24Right:
25  0: MoveRight
26Backspace:
27  0: Back
28'h':
29  0: MoveLeft
30F5:
31  0: Reload
32'k':
33  0: MoveUp
34Esc:
35  0: Deselect
36Home:
37  0: FirstHistory
38Left:
39  0: MoveLeft
40  4: Back
41```
42
43## Keys
44
45Keys can be:
46
47- A single character (e.g. `'q'`)
48- Named keys (e.g. `Up`, `Down`)
49- Function keys (e.g. `F5`)
50
51## Key modifiers
52
53Key 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`.
54
55Each 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`).
56
57### Keys reference
58
59All possible keys can be found <a href="https://docs.rs/crossterm/latest/crossterm/event/enum.KeyCode.html" target=_blank>*here*</a>.
60
61### Key actions
62
63All key actions can be found in [`KeyAction`](https://docs.rs/youtube-tui/latest/youtube_tui/global/structs/enum.KeyAction.html) under [`/src/global/structs/keyaction.rs`](https://github.com/Siriusmart/youtube-tui/blob/master/src/global/structs/keyaction.rs).
64
65### Modifiers reference
66
67|Modifier|Code|
68|---|---|
69|None|`0`|
70|`Shift`|`1`|
71|`Ctrl`|`2`|
72|`Alt`|`4`|
73|`Super`/"Windows" key|`8`|
74|`Hyper`|`16`|
75|`Meta`|`32`|
76
77All 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>.