much simplify and shorten default $PS1 (uses even more magick now)

This commit is contained in:
tg 2008-11-07 20:07:10 +00:00
parent 2697deb55c
commit 5206ddcc65

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/dot.mkshrc,v 1.37 2008/05/17 18:27:55 tg Exp $
# $MirOS: src/bin/mksh/dot.mkshrc,v 1.38 2008/11/07 20:07:10 tg Stab $
#-
# ~/.mkshrc: mksh initialisation file for interactive shells
@ -10,19 +10,10 @@ function precmd {
(( e )) && print -n "$e|"
}
PS1='$(precmd)${USER:=$(ulimit -c 0;id -un 2>&- || print \?)}@${HOSTNAME%%.*}:$(
typeset pfx=~ wd=${PWD:-?}
typeset -i n=${COLUMNS:-80}/3; (( n = n < 7 ? 7 : n ))
[[ $pfx = ?(*/) ]] || wd=${wd/#$pfx/~}
pfx=; while (( (${#pfx} + ${#wd}) > n )); do
if [[ $wd = */* ]]; then
pfx=.../
wd=${wd#*/}
else
pfx=...
wd=${wd#?????}
fi
done; print -nr -- "$pfx$wd") '"$PS1 "
PS1='$(precmd)${USER:=$(ulimit -c 0;id -un 2>&-||print \?)}@${HOSTNAME%%.*}:$(
typeset p=~ d=${PWD:-?}; typeset -i n=${COLUMNS:-80}/3
[[ $p = ?(*/) ]] || d=${d/#$p/~}; (( n=n<7?7:n )); (( ${#d}>n )) && {
p=...; d=${d:(-n)}; } || p=; print -nr -- "$p$d") '"$PS1 "
PS1="$(print -n '\x1\r')$PS1" # allow colour codes, framed with ^A
export EDITOR HOSTNAME LESSHISTFILE=- MKSH=$(whence -p mksh) PS1 TERM USER
alias ls=ls