fix: fish prompt in root directory

keyring
anemofilia 2023-08-06 21:07:35 -03:00
parent 8249bb9528
commit 098cb102d4
1 changed files with 10 additions and 2 deletions

View File

@ -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