superficial changes

This commit is contained in:
Loic Nageleisen 2012-08-14 13:02:19 +02:00
parent 8d701cf804
commit 14df797f62

View file

@ -1,3 +1,9 @@
# truncates a string on the left
# $1: string to truncate
# $2: maximum length
# $3: truncation string replacement (optional)
# $4: separator symbol (optional, prevents truncation of rightmost item)
__truncate_left() { __truncate_left() {
local str="$1" local str="$1"
local maxlen="$2" local maxlen="$2"
@ -23,14 +29,16 @@ __truncate_left() {
echo "$str" echo "$str"
} }
__truncate_dir() { # truncates a path
__truncate_path() {
#gain some place with '~' #gain some place with '~'
dir=${1/#$HOME/\~} local path=${1/#$HOME/\~}
__truncate_left "$dir" 25 '…' '/' __truncate_left "$path" 25 '…' '/'
} }
# truncates CWD
__tpwd() { __tpwd() {
__truncate_dir "$PWD" __truncate_path "$PWD"
} }
#__print_rprompt() { #__print_rprompt() {