Yazi: Difference between revisions
mNo edit summary |
Subjunctive (talk | contribs) m update link to yazi flake documentation |
||
| (9 intermediate revisions by 5 users not shown) | |||
| Line 43: | Line 43: | ||
enable = true; | enable = true; | ||
settings = { | settings = { | ||
yazi = { | |||
ratio = [ | ratio = [ | ||
1 | 1 | ||
| 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 == | ||
| Line 166: | Line 235: | ||
*[https://search.nixos.org/options?channel=unstable&query=programs.yazi NixOS options for Yazi] | *[https://search.nixos.org/options?channel=unstable&query=programs.yazi NixOS options for Yazi] | ||
*[ | *[https://yazi-rs.github.io/docs/installation/ Yazi official documentation] | ||
== References == | == References == | ||
[[Category:Applications]] | [[Category:Applications]] | ||
[[Category:File Manager]] | [[Category:File Manager]] | ||