Skip to content

Commit

Permalink
docs: rename common.md to types.md and fix links
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Feb 25, 2024
1 parent a2ba90e commit 1770a76
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions docs/configuration/yazi.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ Yazi comes with the these previewer plugins:
- pdf: bridge between `pdftoppm` and the preview, offering mixed preview capabilities
- archive: bridge between `unar` and the preview, offering mixed preview and concurrent rendering capabilities

If you want to create your own previewer, see [Previewer API](../plugins/overview.md#previewer).
If you want to create your own previewer, see [Previewer API](../plugins/overview#previewer).

### preloaders

Expand Down Expand Up @@ -284,7 +284,7 @@ Yazi comes with the these preloader plugins:
- video: preloads and caches videos
- pdf: preloads and caches PDFs.

If you want to create your own preloader, see [Preloader API](../plugins/overview.md#preloader).
If you want to create your own preloader, see [Preloader API](../plugins/overview#preloader).

## [input]

Expand Down
2 changes: 1 addition & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ An archive is a file, so it's "openable", but it's also "enterable" as a directo

This is true for a actual directory as well - a directory can be entered (in Yazi), or opened (in programs like VSCode or desktop file managers).

If you truly don't need to distinguish between them, use this [smart-enter tip](/docs/tips.md#smart-enter-enter-for-directory-open-for-file).
If you truly don't need to distinguish between them, use this [smart-enter tip](/docs/tips#smart-enter-enter-for-directory-open-for-file).

## Why do my icons shrink in [kitty](https://sw.kovidgoyal.net/kitty/), and enlarge when scrolling?

Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ To use Yazi, you must have the following prerequisites installed:

Yazi can be _optionally_ extended with other command line tools to enable additional features.

- [nerd-fonts](https://www.nerdfonts.com/) ([_recommended_](./faq.md#i-dont-like-nerdfonts))
- [nerd-fonts](https://www.nerdfonts.com/) ([_recommended_](./faq#i-dont-like-nerdfonts))
- [`ffmpegthumbnailer`](https://github.com/dirkvdb/ffmpegthumbnailer) (for video thumbnails)
- [`unar`](https://theunarchiver.com/command-line) (for archive preview)
- [`jq`](https://jqlang.github.io/jq/) (for JSON preview)
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/config.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 3
sidebar_position: 4
description: Learn how to use Yazi's Lua API.
---

Expand Down
8 changes: 4 additions & 4 deletions docs/plugins/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ ui.Span("string")

Methods (all methods return `self`):

- `ui.Span:fg(color)` - Set the foreground color of the span, which accepts a [Color](../configuration/theme.md#color)
- `ui.Span:bg(color)` - Set the background color of the span, which accepts a [Color](../configuration/theme.md#color)
- `ui.Span:fg(color)` - Set the foreground color of the span, which accepts a [Color](../configuration/theme#color)
- `ui.Span:bg(color)` - Set the background color of the span, which accepts a [Color](../configuration/theme#color)
- `ui.Span:bold()` - Set the span to bold
- `ui.Span:dim()` - Set the span to dim
- `ui.Span:italic()` - Set the span to italic
Expand All @@ -264,8 +264,8 @@ Create a style:
ui.Style()
```

- `ui.Style:fg(string)` - Set the foreground color of the style, which accepts a [Color](../configuration/theme.md#color)
- `ui.Style:bg(string)` - Set the background color of the style, which accepts a [Color](../configuration/theme.md#color)
- `ui.Style:fg(string)` - Set the foreground color of the style, which accepts a [Color](../configuration/theme#color)
- `ui.Style:bg(string)` - Set the background color of the style, which accepts a [Color](../configuration/theme#color)
- `ui.Style:bold()` - Set the style to bold
- `ui.Style:dim()` - Set the style to dim
- `ui.Style:italic()` - Set the style to italic
Expand Down
18 changes: 9 additions & 9 deletions docs/plugins/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ bar.yazi/
A plugin has two usages:

- [Functional plugin](#functional-plugin): Bind the `plugin` command to a key in `keymap.toml`, and activate it by pressing the key.
- [Custom previewers, preloaders](../configuration/yazi.md#plugin): Configure them as `previewers` or `preloaders` in your `[plugin]` of `yazi.toml` file.
- [Custom previewers, preloaders](../configuration/yazi#plugin): Configure them as `previewers` or `preloaders` in your `[plugin]` of `yazi.toml` file.

### Functional plugin

Expand Down Expand Up @@ -171,19 +171,19 @@ return {

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.
- `file`: The [File](./types#file) to be previewed.
- `skip`: The number of units to skip. The units largely depend on your previewer, such as lines for code and percentages for videos.
- `area`: The [Rect](./layout.md#rect) of the available preview area.
- `window`: The [Rect](./layout.md#rect) of the entire terminal window.
- `area`: The [Rect](./layout#rect) of the available preview area.
- `window`: The [Rect](./layout#rect) of the entire terminal window.

When the user presses `Alt-j` or `Alt-k` to scroll the preview of this file, `seek` is called, with:

- `file`: The [File](./common.md#file) being scrolled.
- `area`: The [Rect](./layout.md#rect) of the available preview area.
- `file`: The [File](./types#file) being scrolled.
- `area`: The [Rect](./layout#rect) of the available preview area.

The task of `peek` is to draw in the preview area based on the values of `file` and `skip`. This process is asynchronous.

The task of `seek` is to change the value of `skip` based on user behavior and trigger `peek` again. It is synchronous, meaning you can access [app data](./common.md#app-data) through `cx`.
The task of `seek` is to change the value of `skip` based on user behavior and trigger `peek` again. It is synchronous, meaning you can access [app data](./types#app-data) through `cx`.

Here are some preset previewers and preloaders you can refer to: [Yazi Preset Plugins](https://github.com/sxyazi/yazi/tree/main/yazi-plugin/preset/plugins)

Expand Down Expand Up @@ -215,7 +215,7 @@ When "continue" is set, the preloader can reload the files that have already bee

Yazi will automatically invoke the `preload` concurrently for each file that matches the preload rules on the page.

When the user specifies [`multi = true`](../configuration/yazi.md#preloaders) for it, the plugin allows preloading multiple files at once. In this case, `self.file` will be replaced by `self.files`.
When the user specifies [`multi = true`](../configuration/yazi#preloaders) for it, the plugin allows preloading multiple files at once. In this case, `self.file` will be replaced by `self.files`.

Typically, a preloader only needs to implement one of them - either single or multiple. This depends on the specific task and the magnitude of the workload.
If it truly requires loading multiple files at once, the user needs to be prompted to enable the `multi` option for it.
Expand All @@ -231,7 +231,7 @@ If you have no experience with Lua, you can quickly get started through https://

### Logging

Once you get started, if you want to debug some runtime data, use [`ya.dbg()`](./utils.md#dbgmsg) and [`ya.err()`](./utils.md#errmsg) to print what you want to debug to either:
Once you get started, if you want to debug some runtime data, use [`ya.dbg()`](./utils#dbgmsg) and [`ya.err()`](./utils#errmsg) to print what you want to debug to either:

- `~/.local/state/yazi/yazi.log` on Unix-like systems.
- `C:\Users\USERNAME\AppData\Roaming\yazi\state\yazi.log` on Windows.
8 changes: 4 additions & 4 deletions docs/plugins/common.md → docs/plugins/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sidebar_position: 1
description: Learn how to use Yazi's Lua API.
---

# Common
# Types

## Shared

Expand Down Expand Up @@ -76,7 +76,7 @@ Properties:

## App data

You can access all app data through the `cx` within [Sync context](./overview.md#sync-context):
You can access all app data through the `cx` within [Sync context](./overview#sync-context):

- `cx.active`: The active tab, which is a [tab::Tab](#tabtab)
- `cx.tabs`: All of tabs, which is a [manager::Tabs](#managertabs)
Expand Down Expand Up @@ -145,8 +145,8 @@ Based on [File](#file), with the following additional methods:
- `size()` - The size of this file, returns an integer representing the size in bytes, or `nil` if its a directory and it has not been scanned
- `mime()` - The mime-type string of this file
- `prefix()` - The prefix of this file relative to `CWD`, which used in the flat view during search. For instance, if `CWD` is `/foo`, and the file is `/foo/bar/baz`, then the prefix is `bar/`
- `icon()` - The [Icon](#icon) of this file, [`[icon]`](../configuration/theme.md#icons) rules are applied; if no rule matches, returns `nil`
- `style()` - The [Style](#uistyle) of this file, [`[filetype]`](../configuration/theme.md#filetype) rules are applied; if no rule matches, returns `nil`
- `icon()` - The [Icon](#icon) of this file, [`[icon]`](../configuration/theme#icons) rules are applied; if no rule matches, returns `nil`
- `style()` - The [Style](#uistyle) of this file, [`[filetype]`](../configuration/theme#filetype) rules are applied; if no rule matches, returns `nil`
- `is_hovered()` - Whether this file is hovered
- `is_yanked()` - Whether this file is yanked
- `is_selected()` - Whether this file is selected
Expand Down
22 changes: 11 additions & 11 deletions docs/plugins/utils.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 4
sidebar_position: 3
description: Learn how to use Yazi's Lua API.
---

Expand Down Expand Up @@ -80,21 +80,21 @@ This function is only available in the async context.

### `dbg(msg)`

Append messages to [the log file](./overview.md#logging) at the debug level:
Append messages to [the log file](./overview#logging) at the debug level:

- `msg` - Required, the message to be logged, which is a string

Note that if you use a release build of Yazi, the log level is "error" instead of "debug", so you'll need to use [`ya.err`](#errmsg).

### `err(msg)`

Append messages to [the log file](./overview.md#logging) at the error level:
Append messages to [the log file](./overview#logging) at the error level:

- `msg` - Required, the message to be logged, which is a string

### `sync(fn)`

See [Async context](/docs/plugins/overview.md#async-context).
See [Async context](/docs/plugins/overview#async-context).

### `preview_code(opts)`

Expand Down Expand Up @@ -205,7 +205,7 @@ local ok, err = fs.write(url, "hello world")

Write data to the specified file:

- `url` - Required, the [Url](./common.md#url) of the file
- `url` - Required, the [Url](./types#url) of the file
- `data` - Required, the data to be written, which is a string

Returns `(ok, err)`:
Expand All @@ -219,13 +219,13 @@ Returns `(ok, err)`:
local cha, err = fs.cha(url)
```

Get the [Cha](./common.md#cha) of the specified file, which is faster than [`cha_follow`](#chafollowurl) since it never follows the symbolic link:
Get the [Cha](./types#cha) of the specified file, which is faster than [`cha_follow`](#chafollowurl) since it never follows the symbolic link:

- `url` - Required, the [Url](./common.md#url) of the file
- `url` - Required, the [Url](./types#url) of the file

Returns `(cha, err)`:

- `cha` - The [Cha](./common.md#cha) of the file if successful; otherwise, `nil`
- `cha` - The [Cha](./types#cha) of the file if successful; otherwise, `nil`
- `err` - The error code if the operation is failed, which is an integer if any

### `cha_follow(url)`
Expand All @@ -234,13 +234,13 @@ Returns `(cha, err)`:
local cha, err = fs.cha_follow(url)
```

Get the [Cha](./common.md#cha) of the specified file, and follow the symbolic link:
Get the [Cha](./types#cha) of the specified file, and follow the symbolic link:

- `url` - Required, the [Url](./common.md#url) of the file
- `url` - Required, the [Url](./types#url) of the file

Returns `(cha, err)`:

- `cha` - The [Cha](./common.md#cha) of the file if successful; otherwise, `nil`
- `cha` - The [Cha](./types#cha) of the file if successful; otherwise, `nil`
- `err` - The error code if the operation is failed, which is an integer if any

## Command
Expand Down

0 comments on commit 1770a76

Please sign in to comment.