2006-02-12 23:14:21 +10:00
|
|
|
|
|
|
|
if test (uname) = Darwin
|
2007-01-16 11:29:18 +10:00
|
|
|
function prompt_pwd --description "Print the current working directory, shortend to fit the prompt"
|
2006-02-12 23:14:21 +10:00
|
|
|
if test "$PWD" != "$HOME"
|
2012-06-21 20:32:07 -07:00
|
|
|
printf "%s" (echo $PWD|sed -e 's|^/private\(/.\{1,\}\)|\1|' -e "s|^$HOME|~|" -e 's-/\(\.\{0,1\}[^/]\)\([^/]*\)-/\1-g')
|
2012-06-22 18:35:44 -07:00
|
|
|
echo $PWD|sed -n -e 's-.*/\.\{0,1\}.\([^/]*\)-\1-p'
|
2006-02-12 23:14:21 +10:00
|
|
|
else
|
|
|
|
echo '~'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
2007-01-16 11:29:18 +10:00
|
|
|
function prompt_pwd --description "Print the current working directory, shortend to fit the prompt"
|
2010-09-18 10:18:26 +08:00
|
|
|
switch "$PWD"
|
2007-09-09 05:17:17 +10:00
|
|
|
case "$HOME"
|
2006-02-12 23:14:21 +10:00
|
|
|
echo '~'
|
2007-09-09 05:17:17 +10:00
|
|
|
|
|
|
|
case '*'
|
2008-01-23 04:03:40 +10:00
|
|
|
printf "%s" (echo $PWD|sed -e "s|^$HOME|~|" -e 's-/\(\.\{0,1\}[^/]\)\([^/]*\)-/\1-g')
|
2009-02-21 20:47:59 +10:00
|
|
|
echo $PWD|sed -n -e 's-.*/\.\{0,1\}.\([^/]*\)-\1-p'
|
2006-02-12 23:14:21 +10:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|