docs/src/commands.md
103 lines · 3252 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
47rmcache [id]
48```
49
50> The `flush` command is used to run all tasks in queue immediately, this is usually done automatically.
51>
52> 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.
53
54> `run` is used for running *blocking commands*, while `parrun` is non-blocking.
55
56> 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).
57>
58> More about keymodifiers can be found in the doc page for [`keybindings.yml`](./config/keybindings.md)
59
60## Library
61
62```vim
63bookmark [id] Bookmark item with ID (item must be already loaded)
64unmark [id] Remove bookmark item with ID
65togglemark [id] Toggle bookmark status
66sub/sync [id or url] Add channel to subscription, or sync an existing channel
67unsub [id or url] Remove channel from subscription
68syncall Sync all subscriptions
69```
70
71## MPV commands
72
73<sub>Only with the [`mpv`](installation.md#mpv-default) feature.</sub>
74
75```vim
76mpv prop [label] Gets mpv property
77mpv sprop [label] [value] Set mpv property
78mpv tprop [label] [value] Toggle a yes/no property
79mpv [command] Runs a libmpv command
80```
81
82> Note that properties and commands are **libmpv** commands, *not* mpv commands. Please refer to [mpv reference](https://mpv.io/manual/master/).
83
84## Text commands
85
86Text commands generates a *text only response* without launching the TUI.
87
88```vim
89help
90version
91```
92
93## Command bindings
94
95Commands can be binded to keys just like normal key bindings, bindings can be edited in `commandbindings.yml`. Below are the default bindings:
96
97|Key|Description|
98|---|---|
99|`Ctrl + F`|Open page in browser|
100|`Ctrl + C`|Copy page url|
101|`Ctrl + P`|Play hovered video|
102|`Ctrl + A`|Play hovered audio|
103|`Shift + A`|Play hovered audio on repeat (shuffled if hovering a playlist)|