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