From 3b305d45715baa1d1d7ba17ab6bc0281320eab5c Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Wed, 12 Feb 2020 21:54:30 +0000 Subject: [PATCH] prompt_pwd.fish: Keep the initial / for dirs in / This makes it behave like in zsh. --- config/fish/functions/prompt_pwd.fish | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/fish/functions/prompt_pwd.fish b/config/fish/functions/prompt_pwd.fish index ea2a213..95034e0 100644 --- a/config/fish/functions/prompt_pwd.fish +++ b/config/fish/functions/prompt_pwd.fish @@ -11,6 +11,10 @@ function prompt_pwd --description 'Print the current working directory' # Replace $HOME with "~" set realhome ~ set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD) + set tmp (basename $tmp) - basename $tmp + test $PWD = "/$tmp" + and set tmp $PWD + + echo $tmp end