Skip to content

Commit 3bd625a

Browse files
authored
docs: add README for default configuration files (#2005)
1 parent 9d3c0c7 commit 3bd625a

File tree

5 files changed

+49
-4
lines changed

5 files changed

+49
-4
lines changed

yazi-adapter/src/emulator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl Emulator {
150150
}
151151

152152
fn cell_size(resp: &str) -> Option<(u16, u16)> {
153-
let b = resp.split_at(resp.find("\x1b[6;")? + 4).1.as_bytes();
153+
let b = resp.split_once("\x1b[6;")?.1.as_bytes();
154154

155155
let h: Vec<_> = b.iter().copied().take_while(|&c| c.is_ascii_digit()).collect();
156156
b.get(h.len()).filter(|&&c| c == b';')?;

yazi-config/preset/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Default Configuration
2+
3+
> [!IMPORTANT]
4+
> If you're using a stable release of Yazi instead of the latest nightly build, make sure you're checking these files from [the shipped tag][shipped], not the latest main branch.
5+
6+
This directory contains the default configuration files for Yazi:
7+
8+
- [`yazi-default.toml`][yazi-default]: General configuration
9+
- [`keymap-default.toml`][keymap-default]: Keybindings configuration
10+
- [`theme-dark.toml`][theme-dark]: Dark color scheme (loaded when your terminal is in dark mode)
11+
- [`theme-light.toml`][theme-light]: Light color scheme (loaded when your terminal is in light mode)
12+
13+
These files are already included with Yazi when you install the release, so you don't need to manually download or copy them to your Yazi configuration directory.
14+
15+
However, if you want to customize certain configurations:
16+
17+
- Create a `yazi.toml` in your config directory to override the settings in [`yazi-default.toml`][yazi-default], so either:
18+
- `~/.config/yazi/yazi.toml` on Unix-like systems
19+
- `C:\Users\USERNAME\AppData\Roaming\yazi\config\yazi.toml` on Windows
20+
- Create a `keymap.toml` in your config directory to override the settings in [`keymap-default.toml`][keymap-default], so either:
21+
- `~/.config/yazi/keymap.toml` on Unix-like systems
22+
- `C:\Users\USERNAME\AppData\Roaming\yazi\config\keymap.toml` on Windows
23+
- Create a `theme.toml` in your config directory to override the settings in [`theme-light.toml`][theme-light] and [`theme-dark.toml`][theme-dark], so either:
24+
- `~/.config/yazi/theme.toml` on Unix-like systems
25+
- `C:\Users\USERNAME\AppData\Roaming\yazi\config\theme.toml` on Windows
26+
27+
For the user's `theme.toml` file, you can only apply the same color scheme to both the light and dark themes.
28+
29+
If you want more granular control over colors, specify two different flavors for light and dark modes under the `[flavor]` section of your `theme.toml`, and override them in your respective flavor instead.
30+
31+
[shipped]: https://github.com/sxyazi/yazi/tree/shipped
32+
[yazi-default]: yazi-default.toml
33+
[keymap-default]: keymap-default.toml
34+
[theme-dark]: theme-dark.toml
35+
[theme-light]: theme-light.toml
36+
37+
## Learn more
38+
39+
- [Configuration documentation](https://yazi-rs.github.io/docs/configuration/overview)
40+
- [Flavors documentation](https://yazi-rs.github.io/docs/flavors/overview)
File renamed without changes.
File renamed without changes.

yazi-macro/src/asset.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ macro_rules! config_preset {
44
#[cfg(debug_assertions)]
55
{
66
std::borrow::Cow::from(
7-
std::fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/preset/", $name, ".toml"))
8-
.expect(concat!("Failed to read 'yazi-config/preset/", $name, ".toml'")),
7+
std::fs::read_to_string(concat!(
8+
env!("CARGO_MANIFEST_DIR"),
9+
"/preset/",
10+
$name,
11+
"-default.toml"
12+
))
13+
.expect(concat!("Failed to read 'yazi-config/preset/", $name, "-default.toml'")),
914
)
1015
}
1116
#[cfg(not(debug_assertions))]
@@ -14,7 +19,7 @@ macro_rules! config_preset {
1419
env!("CARGO_MANIFEST_DIR"),
1520
"/preset/",
1621
$name,
17-
".toml"
22+
"-default.toml"
1823
)))
1924
}
2025
}};

0 commit comments

Comments
 (0)