docs/src/commands.md

88 lines · 3045 bytes

 1# Commands
 2
 3Commands can be entered to the TUI by pressing the `:` key, the same as in Vim. Some commands have shorter *alternatives* that can be used instead.
 4
 5> Env variables can be used by passing in as `${key}`, such as `:channel ${channel-id}` when in a video or playlist page.
 6
 7**Loadpage commands** can also be used when launching, for example `youtube-tui loadpage popular` or `youtube-tui popular`.
 8
 9> Commands can be joined together using `;;`.
10
11Below are the avaliable commands:
12
13## Loadpage
14
15`loadpage` can be used to load a specific page.
16
17```vim
18loadpage popular (alt: `popular`)
19loadpage trending (alt: `trending`)
20loadpage watchhistory (alt: `watchhistory`)
21loadpage search [search query] (alt: `search [search query]`)
22loadpage video [id or url] (alt: `video [id or url]`)
23loadpage playlist [id or url] (alt: `playlist [id or url] `)
24loadpage channel [id or url] (alt: `channel [id or url] `)
25```
26
27## History
28
29`history` is used to manage page history (`Backspace` equivalent).
30
31```vim
32history back (alt: `back`)
33history clear
34```
35
36## Utility
37
38```vim
39reload (alt `r`)
40reload configs (alt `reload/r config/configs`)
41flush
42quit (alt `q`, `exit`, `x`)
43run [command]
44parrun [command]
45key [keycode] [keymodifier]
46```
47
48> The `flush` command is used to run all tasks in queue immediately, this is usually done automatically.
49>
50> 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.
51
52> `run` is used for running *blocking commands*, while `parrun` is non-blocking.
53
54> 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).
55>
56> More about keymodifiers can be found in the doc page for [`keybindings.yml`](./config/keybindings.md)
57
58## Library
59
60```vim
61bookmark [id]                   Bookmark item with ID (item must be already loaded)
62unmark [id]                     Remove bookmark item with ID
63togglemark [id]                 Toggle bookmark status
64sub/sync [id or url]            Add channel to subscription, or sync an existing channel
65unsub [id or url]               Remove channel from subscription
66syncall                         Sync all subscriptions
67```
68
69## Text commands
70
71Text commands generates a *text only response* without launching the TUI.
72
73```vim
74help
75version
76```
77
78## Command bindings
79
80Commands can be binded to keys just like normal key bindings, bindings can be edited in `commandbindings.yml`. Below are the default bindings:
81
82|Key|Description|
83|---|---|
84|`Ctrl + F`|Open page in browser|
85|`Ctrl + C`|Copy page url|
86|`Ctrl + P`|Play hovered video|
87|`Ctrl + A`|Play hovered audio|
88|`Shift + A`|Play hovered audio on repeat (shuffled if hovering a playlist)|