From 89f8ece426c3fd2fb93fea0262e9fd946cced222 Mon Sep 17 00:00:00 2001 From: hitsmaxft Date: Fri, 9 Jun 2023 12:42:01 +0800 Subject: [PATCH] add homemanger configuration in readme --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/README.md b/README.md index e7ca40c..72313e7 100644 --- a/README.md +++ b/README.md @@ -265,12 +265,53 @@ plugins+=(sd) source "$ZSH/oh-my-zsh.sh" ``` +## Installation as home-manager module with nix package manager + +add config in your `$HOME/.config/home-manager/home.nix` + +```nix +{...}: { + +# start script directory + +home.programs.script-directory = { + script-directory = { + enable = true; + settings = { + SD_ROOT = "${config.home.homeDirectory}/scripts"; + SD_EDITOR = "vim"; + }; + }; + +}; + + +home.programs.zsh = { + + # script directory module don't config zsh completion automatically + # manually append fpath into zsh.initExtra + + initExtra = '' + + fpath+="${pkgs.script-directory}/share/zsh/site-functions" + ''; +}; +# end script directory + +} + +``` + +read more from [home-manager module source code](https://github.com/nix-community/home-manager/blob/master/modules/programs/script-directory.nix) + + # bash/fish autocompletion support Patrick Jackson contributed [an unofficial fish completion script](https://gist.github.com/patricksjackson/5065e4a9d8e825dafc7824112f17a5e6), which should be usable with some modification (as written it does not respect `SD_ROOT`, but it should act as a very good starting point if you use fish). Bash doesn't support the fancy completion-with-description feature that is sort of the whole point of `sd`, but there are apparently ways to hack something similar. + # Changelog ## v1.1.0 2022-10-30