Use different abbrevation for prompt_pwd

darcs-hash:20051214003427-ac50b-1227b7a0795e2fe3adf4f37c2594033f673b7a5e.gz
This commit is contained in:
axel 2005-12-14 10:34:27 +10:00
parent 16333b0c69
commit 5d069de71d

View File

@ -216,20 +216,11 @@ end
# ellipsised. This function is used by the default prompt command.
#
function prompt_pwd -d "Print the current working directory, ellipsise it if it is longer than 1/4 of the terminal width"
set wd (pwd)
set len (echo $wd|wc -c)
set max_width (echo $COLUMNS/4|bc)
if test $len -gt $max_width
#Write ellipsis character if known to be using UTF
#else use $
set -l ellipsis '$' #default
if expr match "$LANG" ".*UTF" >/dev/null
set ellipsis \u2026
end
printf %s%s $ellipsis (echo $wd|cut -c (echo $len-$max_width-1|bc)- ^/dev/null )
else
echo $wd
function prompt_pwd -d "Print the current working directory, shortend to fit the prompt"
set -l wd (pwd)
printf "%s" $wd|sed -re 's-/([^/])([^/]*)-/\1-g'
if test $wd != '~'
printf "%s\n" $wd|sed -re 's-.*/[^/]([^/]*$)-\1-'
end
end