mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
7492b6cdb3
darcs-hash:20070116012918-ac50b-c1c0df64333ad910ca81dbc86ad193ece6680722.gz
21 lines
628 B
Fish
21 lines
628 B
Fish
|
|
if test (uname) = Darwin
|
|
function prompt_pwd --description "Print the current working directory, shortend to fit the prompt"
|
|
if test "$PWD" != "$HOME"
|
|
printf "%s" (echo $PWD|sed -e 's|/private||' -e "s|^$HOME|~|" -e 's-/\([^/]\)\([^/]*\)-/\1-g')
|
|
echo $PWD|sed -e 's-.*/[^/]\([^/]*$\)-\1-'
|
|
else
|
|
echo '~'
|
|
end
|
|
end
|
|
else
|
|
function prompt_pwd --description "Print the current working directory, shortend to fit the prompt"
|
|
if test "$PWD" != "$HOME"
|
|
printf "%s" (echo $PWD|sed -e "s|^$HOME|~|" -e 's-/\([^/]\)\([^/]*\)-/\1-g')
|
|
echo $PWD|sed -n -e 's-.*/[^/]\([^/]*$\)-\1-p'
|
|
else
|
|
echo '~'
|
|
end
|
|
end
|
|
end
|
|
|