Fix hostname and substr syntax
This commit is contained in:
parent
54ca66d8e5
commit
0bcd953e19
10
zsh/prompt
10
zsh/prompt
|
@ -1,6 +1,13 @@
|
||||||
prompt_pwd() {
|
prompt_pwd() {
|
||||||
SHORTPWD=`print -Pn "%4~"`
|
SHORTPWD=`print -Pn "%4~"`
|
||||||
[[ "${SHORT_PWD:0:1}" =~ "[^/~]" ]] && SHORT_PWD=".../$SHORT_PWD"
|
|
||||||
|
if [[ -n "${ZSH_VERSION:-}" ]]
|
||||||
|
then _pwd="${SHORTPWD[0,1]}"
|
||||||
|
else _pwd="${SHORTPWD:0:1}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ $_pwd =~ "[^/~]" ]] && SHORTPWD=".../$SHORTPWD"
|
||||||
|
|
||||||
echo -n $SHORTPWD
|
echo -n $SHORTPWD
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +35,7 @@ prompt() {
|
||||||
|
|
||||||
# Show the hostname if this is an SSH session
|
# Show the hostname if this is an SSH session
|
||||||
if [[ -n $SSH_CLIENT ]]; then
|
if [[ -n $SSH_CLIENT ]]; then
|
||||||
|
echo -n "%{$fg[blue]%}"
|
||||||
echo -n " $(hostname)"
|
echo -n " $(hostname)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue