diff --git a/files/fish/functions/fish_prompt.fish b/files/fish/functions/fish_prompt.fish index d525f9a..651a6e5 100644 --- a/files/fish/functions/fish_prompt.fish +++ b/files/fish/functions/fish_prompt.fish @@ -18,8 +18,16 @@ end # Current working directory prompt function fish_cwd_prompt set -l cwd (pwd) - test $cwd = $HOME && printf "~" || \ - printf "%s/%s" (basename (dirname $cwd)) (basename $cwd) + switch "$cwd" + case "$HOME" + printf "~" + case "/" + printf "/" + case "*" + set -l parent_dir (basename (dirname $cwd)) + test $parent_dir = "/" || printf "%s" $parent_dir + printf '/%s' (basename $cwd) + end end # Guix environment prompt