Skip to content

Commit

Permalink
docs: switch flavors to BETA and update the note
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Feb 29, 2024
1 parent 6f8c153 commit 507649a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 18 deletions.
2 changes: 1 addition & 1 deletion docs/flavors/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "Flavors (WIP)",
"label": "Flavors (BETA)",
"position": 6,
"link": {
"type": "doc",
Expand Down
20 changes: 12 additions & 8 deletions docs/flavors/overview.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
---
id: overview
sidebar_position: 0
sidebar_label: Flavors (WIP)
sidebar_label: Flavors (BETA)
description: Learn how to use Yazi flavors.
---

# Flavors (WIP)
# Flavors (BETA)

:::note
The flavors is still in early stages, and currently only available in the latest main branch.
:::

The "flavor" is a pre-made Yazi theme, while what we typically refer to as a "theme" is the user's own theme, i.e. `~/.config/yazi/theme.toml` file.

The purpose of separating them is to allow users to customize their preferences more conveniently on top of an existing flavor, without having to modify those flavor files.
This makes it easier to update, as there won't be conflicts when pulling from Git.

Behind the scenes, Yazi merges the user's `theme.toml` with the flavor's `theme.toml` automatically, and the user's always takes precedence over the flavor.
Behind the scenes, Yazi merges the user's `theme.toml` with the flavor's `flavor.toml` automatically, and the user's always takes precedence over the flavor.

## Directory structure

Expand All @@ -29,23 +33,23 @@ These flavors are placed in the `flavors` subdirectory of the Yazi configuration
└── theme.toml
```

Each flavor is a directory ending with `.yazi`, containing at least the following files:
Each flavor is a directory with a hyphen-separated name, ending in `.yazi`, and containing at least the following files:

```
bar.yazi/
├── theme.toml
├── flavor.toml
├── tmtheme.xml
├── screenshot.png
├── README.md
├── screenshot.png
├── LICENSE
└── LICENSE-tmtheme
```

Where:

- `theme.toml` is this flavor's configuration file, in the format consistent with the [user's `theme.toml`](/docs/configuration/theme).
- `flavor.toml` is this flavor's configuration file, in the format consistent with the [user's `theme.toml`](/docs/configuration/theme).
- `tmtheme.xml` is a [tmTheme file](https://www.sublimetext.com/docs/color_schemes_tmtheme.html) that matches the colors of this flavor for code highlighting.
- `screenshot.png` and `README.md` are the screenshot and the description of this flavor, respectively.
- `README.md` and `screenshot.png` are the screenshot and the description of this flavor, respectively.
- `LICENSE` and `LICENSE-tmtheme` are the licenses for the flavor and the `tmtheme.xml` file, respectively.

## Cooking a flavor
Expand Down
22 changes: 14 additions & 8 deletions docs/plugins/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ You can extend Yazi's functionality through Lua plugins, which need to be placed
└── yazi.toml
```

Each plugin is a directory ending with `.yazi`, containing at least the following files:
Each plugin is a directory with a hyphen-separated name, ending in `.yazi`, and containing at least the following files:

```
bar.yazi/
├── init.lua
├── LICENSE
└── README.md
├── README.md
└── LICENSE
```

Where:

- `init.lua` is the entry point of this plugin.
- `LICENSE` is the license file for this plugin.
- `README.md` is the documentation of this plugin.
- `LICENSE` is the license file for this plugin.

## Usage

Expand Down Expand Up @@ -80,14 +80,20 @@ This is because `init.lua` is commonly used to initialize plugin configurations,

```lua
-- ~/.config/yazi/init.lua

-- Initialize the bar plugin
-- Which needs `~/.config/yazi/plugins/bar.yazi/init.lua` to export a `setup` function
require("bar").setup {
require("bar"):setup {
key1 = "value1",
key2 = "value2",
-- ...
}

-- ~/.config/yazi/plugins/bar.yazi/init.lua
return {
setup(state, opts)
-- Save the user configuration to the plugin state
state.key1 = opts.key1
state.key2 = opts.key2
end,
}
```

### Sync context
Expand Down
2 changes: 1 addition & 1 deletion docs/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: Some awesome plugins for Yazi.
:::warning
The plugin system is still in the early stage, and most of the plugins below only guarantee compatibility with the latest main branch of Yazi!

Please make sure that both your Yazi and plugins are on the latest main branch to ensure proper functionality!
Please make sure that both your Yazi and plugins are on the `HEAD` to ensure proper functionality!
:::

## 🖼️ Previewers
Expand Down

0 comments on commit 507649a

Please sign in to comment.