diff --git a/docs/installation.md b/docs/installation.md index fdc544bb..1f401874 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -63,7 +63,75 @@ environment.systemPackages = with pkgs; [ ]; ``` -You can also manage Yazi's configuration using [home-manager](https://nix-community.github.io/home-manager/options.xhtml#opt-programs.yazi.enable). +You can also manage Yazi's configuration using [home-manager](https://nix-community.github.io/home-manager/options.xhtml#opt-programs.yazi.enable), here is a configuration template example: + +
+ Demonstrate configuring Yazi with home-manager + +```nix +{pkgs, ...}: let + plugins-repo = pkgs.fetchFromGitHub { + owner = "yazi-rs"; + repo = "plugins"; + rev = "8d1aa6c7839b868973e34f6160055d824bb8c399"; + hash = "sha256-EuXkiK80a1roD6ZJs5KEvXELcQhhBtAH5VyfW9YFRc8="; + }; +in { + programs.yazi = { + enable = true; + enableZshIntegration = true; + shellWrapperName = "y"; + + settings = { + manager = { + show_hidden = true; + }; + preview = { + max_width = 1000; + max_height = 1000; + }; + }; + + plugins = { + chmod = "${plugins-repo}/chmod.yazi"; + hide-preview = "${plugins-repo}/hide-preview.yazi"; + max-preview = "${plugins-repo}/max-preview.yazi"; + starship = pkgs.fetchFromGitHub { + owner = "Rolv-Apneseth"; + repo = "starship.yazi"; + rev = "6197e4cca4caed0121654079151632f6abcdcae9"; + sha256 = "sha256-oHoBq7BESjGeKsaBnDt0TXV78ggGCdYndLpcwwQ8Zts="; + }; + }; + + initLua = '' + require("starship"):setup() + ''; + + keymap = { + manager.prepend_keymap = [ + { + on = ["t"]; + run = "plugin --sync hide-preview"; + desc = "Switch the preview pane between hidden and shown"; + } + { + on = ["T"]; + run = "plugin --sync max-preview"; + desc = "Maximize or restore the preview pane"; + } + { + on = ["c" "m"]; + run = "plugin chmod"; + desc = "Chmod on selected files"; + } + ]; + }; + }; +} +``` + +
## Nix flakes