diff --git a/docs/docs/usage/shell.md b/docs/docs/usage/shell.md index 33f6f24c8..aad7404c8 100644 --- a/docs/docs/usage/shell.md +++ b/docs/docs/usage/shell.md @@ -41,3 +41,12 @@ in order for the changes to take effect. ```shell hermit shell-hooks --bash ``` + +### Fish + +This will install Hermit hooks into `~/.config/fish/conf.d/hermit.fish`. Restart your shell +in order for the changes to take effect. + +```shell +hermit shell-hooks --fish +```` diff --git a/shell/files/fish_hooks.fish b/shell/files/fish_hooks.fish index 2324217e9..4e02ef70d 100644 --- a/shell/files/fish_hooks.fish +++ b/shell/files/fish_hooks.fish @@ -25,3 +25,13 @@ function activate_hermit --on-variable PWD type -q _hermit_deactivate; and _hermit_deactivate end end + +function __complete_hermit + set -q HERMIT_ROOT_BIN; or set HERMIT_ROOT_BIN "$HOME/bin/hermit" + set -lx COMP_LINE (commandline -cp) + test -z (commandline -ct) + and set COMP_LINE "$COMP_LINE " + $HERMIT_ROOT_BIN noop +end + +complete -f -c hermit -a "(__complete_hermit)" diff --git a/shell/hooks.go b/shell/hooks.go index 7503b65c7..16e7ee6e0 100644 --- a/shell/hooks.go +++ b/shell/hooks.go @@ -18,7 +18,6 @@ const ( fishInstallationScript = `if status is-interactive set -q HERMIT_ROOT_BIN; or set HERMIT_ROOT_BIN $HOME/bin/hermit - echo "Using $HERMIT_ROOT_BIN" eval "$(test -x $HERMIT_ROOT_BIN && $HERMIT_ROOT_BIN shell-hooks --print --fish)" end` )