From 2ccb57076d13bedadc24e984ce005e34387ad291 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Sat, 20 Jan 2024 07:27:00 +0800 Subject: [PATCH] docs: split searching from file operations --- docs/plugins/common.md | 4 ++-- docs/plugins/overview.md | 8 +++++--- docs/quick-start.md | 29 +++++++++++++++++------------ 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/docs/plugins/common.md b/docs/plugins/common.md index dae3c312..41d7b9e1 100644 --- a/docs/plugins/common.md +++ b/docs/plugins/common.md @@ -125,8 +125,8 @@ Properties: - `cwd` - The current working directory of this folder, which is a [Url](#url) - `offset` - The offset of this folder, which is an integer - `cursor` - The cursor position of this folder, which is an integer -- `window` - A table of [File](#file)s in the visible area of this folder -- `files` - The [Files](#folderfiles) of this folder +- `window` - A table of [File](#file) in the visible area of this folder +- `files` - The [`folder::Files`](#folderfiles) of this folder - `hovered` - The hovered [File](#file) of this folder, or `nil` if there is no hovered file ### `folder::Files` diff --git a/docs/plugins/overview.md b/docs/plugins/overview.md index fce8c244..71f5d9b0 100644 --- a/docs/plugins/overview.md +++ b/docs/plugins/overview.md @@ -95,6 +95,8 @@ return { ### Previewer +A previewer needs to return a table that implements the `peek` and `seek` functions. Both functions take a table parameter `self` and do not return any values: + ```lua return { peek = function(self) return end, @@ -102,8 +104,6 @@ return { } ``` -A previewer needs to return an table that implements the `peek` and `seek` functions. Both functions take a table parameter `self` and do not return any values. - When the user presses `j` or `k` to switch between hovering files, `peek` is called, with: - `file`: The [File](./common.md#file) to be previewed. @@ -124,6 +124,8 @@ Here are some preset previewers and preloaders you can refer to: [Yazi Preset Pl ### Preloader +You need to return a table that implements the `preload` function, it receives a `self` parameter, which is a table with the same fields as [`peek`](#previewer): + ```lua return { preload = function(self) @@ -132,7 +134,7 @@ return { } ``` -You need to return an table that implements the `preload` function, it receives a `self` parameter, which is a table with the same fields as [`peek`](#previewer). It has the following return values: +And has the following return values: | Binary | Decimal | | | ------ | ------- | ----------------------- | diff --git a/docs/quick-start.md b/docs/quick-start.md index aa44e361..be568d49 100644 --- a/docs/quick-start.md +++ b/docs/quick-start.md @@ -91,13 +91,13 @@ For all key bindings, see the [default `keymap.toml` file](https://github.com/sx ### Navigation -To navigate between files and directories you can use the arrow keys `←`, `↑`, `↓` and `→` or vi(m)-like commands such as `h`, `j`, `k`, `l`: +To navigate between files and directories you can use the arrow keys `←`, `↑`, `↓` and `→` or Vim-like commands such as `h`, `j`, `k`, `l`: | Key binding | Alternate key | Action | | ----------- | ------------- | ----------------------------------------------- | | k | ↑ | Move the cursor up | | j | ↓ | Move the cursor down | -| l | → | Enter highlighted directory | +| l | → | Enter hovered directory | | h | ← | Leave the current directory and into its parent | Further navigation commands can be found in the table below. @@ -113,14 +113,14 @@ Further navigation commands can be found in the table below. To select files and directories, the following commands are available. -| Key binding | Action | -| ----------- | ---------------------------------------------- | -| \ | Toggle selection of highlighted file/directory | -| v | Enter visual mode (selection mode) | -| V | Enter visual mode (unset mode) | -| \ | Select all files | -| \ | Inverse selection of all files | -| \ | Cancel selection | +| Key binding | Action | +| ----------- | ------------------------------------------ | +| \ | Toggle selection of hovered file/directory | +| v | Enter visual mode (selection mode) | +| V | Enter visual mode (unset mode) | +| \ | Select all files | +| \ | Inverse selection of all files | +| \ | Cancel selection | ### File/directory operations @@ -145,8 +145,6 @@ To interact with selected files/directories use any of the commands below. | ; | Run a shell command | | : | Run a shell command (block the UI until the command finishes) | | . | Toggle the visibility of hidden files | -| s | Search files by name using fd | -| S | Search files by content using ripgrep | | \ | Cancel the ongoing search | | z | Jump to a directory using zoxide | | Z | Jump to a directory, or reveal a file using fzf | @@ -179,6 +177,13 @@ _Observation: `c ⇒ d` indicates pressing the `c` key followed by pressing the | n | Jump to next occurrence | | N | Jump to previous occurrence | +### Searching files/directories + +| Key binding | Action | +| ----------- | ------------------------------------------------------------------------------ | +| s | Search files by name using [fd](https://github.com/sharkdp/fd) | +| S | Search files by content using [ripgrep](https://github.com/BurntSushi/ripgrep) | + ### Sorting To sort files/directories use the following commands.