Skip to content

Commit

Permalink
docs: new toggle and toggle_all commands
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Nov 3, 2024
1 parent 91d6499 commit 911f62f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 331 deletions.
360 changes: 30 additions & 330 deletions docs/configuration/keymap.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,32 @@ Note that `--state=false` will deselect all files in the current working directo

If you have selected files across directories and want to deselect all of them, use [`escape --select`](#manager.escape) instead.

### `toggle` {#manager.toggle}

**Note**: This command is introduced in the upcoming v0.4 to replace `select` and currently requires the nightly build.

Toggle the selection state of the hovered file.

| Argument/Option | Description |
| --------------- | ---------------------- |
| N/A | Reverse the selection. |
| `on` | Select the file. |
| `off` | Deselect the file. |

### `toggle_all` {#manager.toggle_all}

**Note**: This command is introduced in the upcoming v0.4 to replace `select_all` and currently requires the nightly build.

Toggle the selection state of all files in the current working directory.

| Argument/Option | Description |
| --------------- | ----------------------- |
| N/A | Reverse the selections. |
| `on` | Select the files. |
| `off` | Deselect the files. |

Note that `toggle_all off` only deselect the files in CWD, if you have selected files across multiple directories, and want to deselect all of them, use [`escape --select`](#manager.escape).

### `visual_mode` {#manager.visual_mode}

Enter visual mode (selection mode).
Expand Down Expand Up @@ -336,333 +362,7 @@ You can use the following shell variables in `[run]`:

Set the visibility of hidden files.

| Argument/Option | Description |
| --------------- | --------------------------------- |
| `show` | Show hidden files. |
| `hide` | Hide hidden files. |
| `toggle` | Default, toggle the hidden state. |

### `linemode` {#manager.linemode}

Set the [line mode](/docs/configuration/yazi#manager.linemode).

| Argument/Option | Description |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `none` | No line mode. |
| `size` | Display the size in bytes of the file. Note that currently directory sizes are only evaluated when [`sort_by = "size"`](/docs/configuration/yazi#manager.sort_by), and this might change in the future. |
| `ctime` | Display the creation time of the file. |
| `mtime` | Display the last modified time of the file. |
| `permissions` | Display the permissions of the file, only available on Unix-like systems. |
| `owner` | Display the owner of the file, only available on Unix-like systems. |

### `search` {#manager.search}

| Argument/Option | Description |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `[engine]` | Search engine, available values: [`fd`](https://github.com/sharkdp/fd), [`rg`](https://github.com/BurntSushi/ripgrep), `none` (cancel search) |
| `--args` | Additional arguments passed to the specified engine, for example `search fd --args='-e -H'` |

You can search with an empty keyword (`""`) via `fd` to achieve flat view.

<details>
<summary>Demonstrate flat view</summary>
<p>Original post: https://github.com/sxyazi/yazi/issues/676#issuecomment-1943494129</p>
<video src="https://github.com/sxyazi/yazi/assets/17523360/d2c9df9b-b7ef-41ec-889f-26b2f1117cd0" width="100%" controls muted></video>
</details>

Or bind a key to the `search_do` command to quickly switch to the flat view:

```toml
[[manager.prepend_keymap]]
on = [ "g", "f" ]
run = 'search_do --via=fd --args="-d 3"'
desc = "Switch to the flat view with a max depth of 3"
```

### `find` {#manager.find}

| Argument/Option | Description |
| --------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `[query]` | Optional, the query to find for. If not provided, an interactive UI will be used to input with. |
| `--previous` | Find for the previous occurrence. |
| `--smart` | Use smart-case when finding, i.e. case-sensitive if the query contains uppercase characters, otherwise case-insensitive. |
| `--insensitive` | Use case-insensitive find. |

### `find_arrow` {#manager.find_arrow}

Move the cursor to the next or previous occurrence.

| Argument/Option | Description |
| --------------- | -------------------------------- |
| `--previous` | Move to the previous occurrence. |

### `filter` {#manager.filter}

| Argument/Option | Description |
| --------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `[query]` | Optional, the query to filter for. If not provided, an interactive UI will be used to input with. |
| `--smart` | Use smart-case when filtering, i.e. case-sensitive if the query contains uppercase characters, otherwise case-insensitive. |
| `--insensitive` | Use case-insensitive filter. |

### `sort` {#manager.sort}

- `[by]`: Optional, if not provided, the sort method will be kept unchanged.
- `"none"`: Don't sort.
- `"modified"`: Sort by last modified time.
- `"created"`: Sort by creation time. (Due to a Rust bug, this is not available at the moment, see [sxyazi/yazi#356](https://github.com/sxyazi/yazi/issues/356) and [rust-lang/rust#108277](https://github.com/rust-lang/rust/issues/108277))
- `"extension"`: Sort by file extension.
- `"alphabetical"`: Sort alphabetically, e.g. `1.md` < `10.md` < `2.md`
- `"natural"`: Sort naturally, e.g. `1.md` < `2.md` < `10.md`
- `"size"`: Sort by file size.
- `"random"`: Sort randomly.
- `--reverse`: Display files in reverse order. `--reverse` or `--reverse=yes` to reverse, `--reverse=no` to cancel.
- `--dir-first`: Display directories first. `--dir-first` or `--dir-first=yes` to enable, `--dir-first=no` to cancel.
- `--translit`: Transliterate filenames for sorting, see [sort_translit](/docs/configuration/yazi#manager.sort_translit) for details. `--translit` or `--translit=yes` to enable, `--translit=no` to cancel.

### `tab_create` {#manager.tab_create}

| Argument/Option | Description |
| --------------- | ---------------------------------------------------- |
| `[path]` | Optional, create a new tab using the specified path. |
| `--current` | Optional, create a new tab using the current path. |

If neither `[path]` nor `--current` is specified, will use the startup directory to create the tab.

### `tab_close` {#manager.tab_close}

| Argument/Option | Description |
| --------------- | ----------------------------------------------- |
| `[n]` | Close the tab at position `n`, starting from 0. |

### `tab_switch` {#manager.tab_switch}

| Argument/Option | Description |
| --------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `[n]` | Switch to the tab at position `n`, starting from 0. |
| `--relative` | Switch to the tab at a position relative to the current tab. The value of `n` can be negative when using this parameter. |

### `tab_swap` {#manager.tab_swap}

| Argument/Option | Description |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `[n]` | Swap the current tab with the tab at position `n`, where negative values move the tab forward, and positive values move it backward. |

### `tasks_show` {#manager.tasks_show}

Show the task manager.

### `help` {#manager.help}

Open the help menu.

### `plugin` {#manager.plugin}

See [Functional plugin](/docs/plugins/overview#functional-plugin).

## [tasks] {#tasks}

### `close` {#tasks.close}

Hide the task manager.

### `arrow` {#tasks.arrow}

| Argument/Option | Description |
| --------------- | ---------------------------- |
| `-1` | Move the cursor up 1 line. |
| `1` | Move the cursor down 1 line. |

### `inspect` {#tasks.inspect}

Inspect the task (press `q` to exit the inspect view).

### `cancel` {#tasks.cancel}

Cancel the task.

### `help` {#tasks.help}

Open the help menu.

### `plugin` {#tasks.plugin}

See [Functional plugin](/docs/plugins/overview#functional-plugin).

## [select] {#select}

### `close` {#select.close}

Cancel selection.

| Argument/Option | Description |
| --------------- | --------------------- |
| `--submit` | Submit the selection. |

### `arrow` {#select.arrow}

| Argument/Option | Description |
| --------------- | ------------------------------------------------------------------------------------- |
| `[n]` | Move the cursor up or down `n` lines. Negative value for up, positive value for down. |

### `help` {#select.help}

Open the help menu.

### `plugin` {#select.plugin}

See [Functional plugin](/docs/plugins/overview#functional-plugin).

## [input] {#input}

### `close` {#input.close}

Cancel input.

| Argument/Option | Description |
| --------------- | ----------------- |
| `--submit` | Submit the input. |

### `escape` {#input.escape}

Go back the normal mode, or cancel input.

### `move` {#input.move}

Move the cursor left or right.

| Argument/Option | Description |
| ---------------- | ------------------------------------------------------------------------------------------------ |
| `[n]` | Move the cursor `n` characters left or right. Negative value for left, positive value for right. |
| `--in-operating` | Move the cursor only if its currently waiting for an operation. |

### `backward` {#input.backward}

Move back to the start of the current or previous word.

### `forward` {#input.forward}

Move forward to the start of the next word.

| Argument/Option | Description |
| --------------- | ---------------------------------------------------- |
| `--end-of-word` | Move forward to the end of the current or next word. |

### `insert` {#input.insert}

Enter insert mode. This command is only available in normal mode.

| Argument/Option | Description |
| --------------- | ------------------------ |
| `--append` | Insert after the cursor. |

### `visual` {#input.visual}

Enter visual mode. This command is only available in normal mode.

### `delete` {#input.delete}

Delete the selected characters. This command is only available in normal mode.

| Argument/Option | Description |
| --------------- | -------------------------------------------------------------------------- |
| `--cut` | Cut the selected characters into clipboard, instead of only deleting them. |
| `--insert` | Delete and enter insert mode. |

### `yank` {#input.yank}

Copy the selected characters. This command is only available in normal mode.

### `paste` {#input.paste}

Paste the copied characters after the cursor. This command is only available in normal mode.

| Argument/Option | Description |
| --------------- | ---------------------------------------------- |
| `--before` | Paste the copied characters before the cursor. |

### `undo` {#input.undo}

Undo the last operation. This command is only available in normal mode.

### `redo` {#input.redo}

Redo the last operation. This command is only available in normal mode.

### `help` {#input.help}

Open the help menu. This command is only available in normal mode.

### `backspace` {#input.backspace}

Delete the character before the cursor. This command is only available in insert mode.

| Argument/Option | Description |
| --------------- | -------------------------------------- |
| `--under` | Delete the character under the cursor. |

### `kill` {#input.kill}

Kill the specified range of characters. This command is only available in insert mode.

| Argument/Option | Description |
| --------------- | ------------------------------------------------ |
| `bol` | Kill backwards to the BOL. |
| `eol` | Kill forwards to the EOL. |
| `backward` | Kill backwards to the start of the current word. |
| `forward` | Kill forwards to the end of the current word. |

### `plugin` {#input.plugin}

See [Functional plugin](/docs/plugins/overview#functional-plugin). This command is only available in insert mode.

## [completion] {#completion}

### `close` {#completion.close}

Hide the completion menu.

| Argument/Option | Description |
| --------------- | ---------------------- |
| `--submit` | Submit the completion. |

### `close_input` {#completion.close_input}

Close the input box. Arguments are the same as [`[input] close`](#input.close).

### `arrow` {#completion.arrow}

| Argument/Option | Description |
| --------------- | ------------------------------------------------------------------------------------- |
| `[n]` | Move the cursor up or down `n` lines. Negative value for up, positive value for down. |

### `help` {#completion.help}

Open the help menu.

### `plugin` {#completion.plugin}

See [Functional plugin](/docs/plugins/overview#functional-plugin).

## [help] {#help}

### `close` {#help.close}

Hide the help menu.

### `escape` {#help.escape}

Clear the filter, or hide the help menu.

### `arrow` {#help.arrow}

| Argument/Option | Description |
| --------------- | ------------------------------------------------------------------------------------- |
| `[n]` | Move the cursor up or down `n` lines. Negative value for up, positive value for down. |

### `filter` {#help.filter}

Apply a filter for the help items.

### `plugin` {#help.plugin}

See [Functional plugin](/docs/plugins/overview#functional-plugin).
| Argument/Option | Description |
| --------------- | ------------------ |
| `show` | Show hidden files. |
| `hide` | Hide hidden files. |
2 changes: 1 addition & 1 deletion docs/image-preview.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ This is by no means a simple task, to reduce maintenance costs, we only guarante
| [Mintty](https://github.com/mintty/mintty) (Git Bash) | [Inline images protocol][iip] | ✅ Built-in |
| [Black Box](https://gitlab.gnome.org/raggesilver/blackbox) | [Sixel graphics format][sixel] | ✅ Built-in |
| [Hyper](https://github.com/vercel/hyper) | [Inline images protocol][iip] | ✅ Built-in |
| X11 / Wayland | Window system protocol | ☑️ [Überzug++][ueberzug] required |
| X11 / Wayland | Window system protocol | ☑️[Überzug++][ueberzug] required |
| Fallback | [ASCII art (Unicode block)][ascii-art] | ☑️ [Chafa][chafa] required |

Yazi automatically selects the appropriate preview method for you, based on the priority from top to bottom.
Expand Down

0 comments on commit 911f62f

Please sign in to comment.