docs/src/commands.md
102 lines · 3239 bytes
1# Commands
2
3Commands can be entered to the TUI by pressing the `:` key, the same as in Vim.
4
5Run the help command to view more detailed help.
6
7```sh
8youtube-tui help
9```
10
11> Env variables can be used by passing in as `${key}`, such as `:channel ${channel-id}` when in a video or playlist page.
12
13**Loadpage commands** can also be used when launching, for example `youtube-tui loadpage popular` or `youtube-tui popular`.
14
15> Commands can be joined together using `;;`.
16
17Below are the avaliable commands:
18
19## Loadpage
20
21`loadpage` can be used to load a specific page.
22
23```vim
24loadpage [page]
25```
26
27## History
28
29`history` is used to manage page history (`Backspace` equivalent).
30
31```vim
32history back
33history clear
34```
35
36## Utility
37
38```vim
39reload // reloads the page
40reload configs // reload config files in ~/.config/youtube-tui/
41flush
42quit
43run [command]
44parrun [command]
45key [keycode] [keymodifier]
46echo [mode] (message) # run youtube-tui help to learn more about modes
47```
48
49> The `flush` command is used to run all tasks in queue immediately, this is usually done automatically.
50>
51> But for when tasks are stacked up in the *same* event loop and the order of which they are executed matters, this command can be used to force the already stacked up commands to be ran first.
52
53> `run` is used for running *blocking commands*, while `parrun` is non-blocking.
54
55> Valid keycodes are the same as in [`keybindings.yml`](./config/keybindings.md) and [`commandbindings.yml`](./config/commandbindings.md). For a full list of keys, check out [`KeyCodeSerde`](https://docs.rs/youtube-tui/latest/youtube_tui/config/serde/enum.KeyCodeSerde.html) in [`/src/config/serde.rs`](https://github.com/Siriusmart/youtube-tui/blob/master/src/config/serde.rs).
56>
57> More about keymodifiers can be found in the doc page for [`keybindings.yml`](./config/keybindings.md)
58
59## Library
60
61```vim
62bookmark [id] Bookmark item with ID (item must be already loaded)
63unmark [id] Remove bookmark item with ID
64togglemark [id] Toggle bookmark status
65sub/sync [id or url] Add channel to subscription, or sync an existing channel
66unsub [id or url] Remove channel from subscription
67syncall Sync all subscriptions
68```
69
70## MPV commands
71
72<sub>Only with the [`mpv`](installation.md#mpv-default) feature.</sub>
73
74```vim
75mpv prop [label] Gets mpv property
76mpv sprop [label] [value] Set mpv property
77mpv tprop [label] [value] Toggle a yes/no property
78mpv [command] Runs a libmpv command
79```
80
81> Note that properties and commands are **libmpv** commands, *not* mpv commands. Please refer to [mpv reference](https://mpv.io/manual/master/).
82
83## Text commands
84
85Text commands generates a *text only response* without launching the TUI.
86
87```vim
88help
89version
90```
91
92## Command bindings
93
94Commands can be binded to keys just like normal key bindings, bindings can be edited in `commandbindings.yml`. Below are the default bindings:
95
96|Key|Description|
97|---|---|
98|`Ctrl + F`|Open page in browser|
99|`Ctrl + C`|Copy page url|
100|`Ctrl + P`|Play hovered video|
101|`Ctrl + A`|Play hovered audio|
102|`Shift + A`|Play hovered audio on repeat (shuffled if hovering a playlist)|