Yazi: Difference between revisions
m Changed config option to reflect current config: https://search.nixos.org/options?channel=25.11&query=programs.yazi.settings. |
fixed advanced config example |
||
| (8 intermediate revisions by 4 users not shown) | |||
| Line 44: | Line 44: | ||
settings = { | settings = { | ||
yazi = { | yazi = { | ||
ratio = [ | mgr = { | ||
ratio = [ | |||
1 | |||
4 | |||
3 | |||
]; | |||
sort_by = "natural"; | |||
sort_sensitive = true; | |||
sort_reverse = false; | |||
sort_dir_first = true; | |||
linemode = "none"; | |||
show_hidden = true; | |||
show_symlink = true; | |||
}; | |||
preview = { | |||
image_filter = "lanczos3"; | |||
image_quality = 90; | |||
tab_size = 1; | |||
max_width = 600; | |||
max_height = 900; | |||
cache_dir = ""; | |||
ueberzug_scale = 1; | |||
ueberzug_offset = [ | |||
0 | |||
0 | |||
0 | |||
0 | |||
]; | |||
}; | |||
tasks = { | |||
micro_workers = 5; | |||
macro_workers = 10; | |||
bizarre_retry = 5; | |||
}; | |||
}; | }; | ||
}; | }; | ||
| Line 84: | Line 84: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== | == Using separate files == | ||
If you would like to use your existing files to keep them portable, you can import them into your configuration directly to be read and built by nix. | |||
{{File|3=programs.yazi = { | |||
enable = true; | |||
plugins = { | |||
inherit (pkgs.yaziPlugins) mount; | |||
}; | |||
#initLua = ./init.lua | |||
settings = lib.importTOML ./yazi.toml; # yazi/yazi.toml | |||
keymap = lib.importTOML ./keymap.toml; | |||
theme = lib.importTOML ./theme.toml; | |||
};|name=/etc/nixos/configuration.nix|lang=nix}} | |||
== Plugins == | |||
==== Installing Plugins ==== | ==== Installing Plugins ==== | ||
| Line 90: | Line 103: | ||
There are some additional yazi plugins packaged in the [https://github.com/lordkekz/nix-yazi-plugins nix-yazi-plugins] flake. It also provides home-manager modules for configuring the plugins' options. | There are some additional yazi plugins packaged in the [https://github.com/lordkekz/nix-yazi-plugins nix-yazi-plugins] flake. It also provides home-manager modules for configuring the plugins' options. | ||
==== home-manager ==== | |||
{{File|3=programs.yazi = { | |||
enable = true; | |||
plugins = with pkgs.yaziPlugins; { | |||
# Plugins that don't call setup() can be configured in one line | |||
smart-enter.package = smart-enter; | |||
chmod.package = chmod; | |||
# Yatline-Catppuccin needs to be setup into a variable later | |||
yatline-catppuccin.package = yatline-catppuccin; | |||
# Plugins with setup({settings}) | |||
yatline = { | |||
package = yatline; | |||
setup = true; | |||
settings = { | |||
tab_width = 20; | |||
# Return as lua code | |||
theme = lib.mkLuaInline ''require("yatline-catppuccin"):setup("mocha")''; | |||
}; | |||
}; | |||
}; | |||
};|name=/etc/nixos/configuration.nix|lang=nix}} | |||
== Flavors == | |||
With <code>plugins = {}</code> you can install plugins into your Yazi configuration directory (<code>~/.config/yazi</code> on unix-like systems by default). Similarly, when installing flavors or themes, use <code>flavors = {}</code>. For example:<syntaxhighlight lang="nix"> | |||
flavors = { | |||
inherit (pkgs.yaziPlugins) kanagawa; | |||
}; | |||
theme = { | |||
flavor = { | |||
dark = "kanagawa"; | |||
}; | |||
}; | |||
</syntaxhighlight> | |||
== Tips and tricks == | |||
==== Bleeding edge ==== | ==== Bleeding edge ==== | ||
The upstream repository provides a flake so that Nix users can easily keep up with the bleeding edge.<ref>https://yazi-rs.github.io/docs/installation/# | The upstream repository provides a flake so that Nix users can easily keep up with the bleeding edge.<ref>https://yazi-rs.github.io/docs/installation/#flakes</ref><syntaxhighlight lang="nix"> | ||
inputs = { | inputs = { | ||
yazi.url = "github:sxyazi/yazi"; | yazi.url = "github:sxyazi/yazi"; | ||
| Line 155: | Line 206: | ||
]; | ]; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==== Easy directory keymap ==== | |||
{{File|3=programs.yazi = { | |||
enable = true; | |||
keymap.mgr.prepend_keymap = [ | |||
# Add your other keymaps here | |||
] ++ lib.mapAttrsToList(dir: key: let | |||
keys = if lib.isString key then [ "b" key ] else [ "b" ] ++ key; | |||
in { | |||
on = keys; | |||
run = ''cd ${dir}''; | |||
desc = ''Go to ${dir}''; | |||
}) { | |||
"/mnt/drive/" = "d"; | |||
"~/.steam/steam/steamapps/" = ["s" "s"]; | |||
"~/.steam/steam/steamapps/common" = ["s" "c"]; | |||
}; | |||
};|name=/etc/nixos/configuration.nix|lang=nix}} | |||
== Troubleshooting == | == Troubleshooting == | ||