Redesign zsh prompt (a little easier on the eyes)
This commit is contained in:
parent
7693db7df5
commit
90889f5f88
55
zsh/prompt
55
zsh/prompt
|
@ -3,37 +3,50 @@
|
||||||
function short_pwd() {
|
function short_pwd() {
|
||||||
SHORTPWD=`print -Pn "%4~"`
|
SHORTPWD=`print -Pn "%4~"`
|
||||||
[[ "${SHORT_PWD:0:1}" =~ "[^/~]" ]] && SHORT_PWD=".../$SHORT_PWD"
|
[[ "${SHORT_PWD:0:1}" =~ "[^/~]" ]] && SHORT_PWD=".../$SHORT_PWD"
|
||||||
|
echo -n $SHORTPWD
|
||||||
|
}
|
||||||
|
|
||||||
echo $SHORTPWD
|
function git_prompt() {
|
||||||
|
if [ "`git_prompt_info`" ]; then
|
||||||
|
echo -n "$(git_prompt_info)"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# GIT Stuff
|
# GIT Stuff
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[white]%}"
|
ZSH_THEME_GIT_PROMPT_PREFIX=" :%{$fg[white]%}"
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX=""
|
ZSH_THEME_GIT_PROMPT_SUFFIX=""
|
||||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}+%{$fg[white]%}"
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}+%{$fg[white]%}"
|
||||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
# ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||||
|
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Build Prompt #
|
# Build Prompt #
|
||||||
##################
|
##################
|
||||||
|
|
||||||
# Left side
|
prompt() {
|
||||||
PROMPT="
|
echo -n "%{$fg[red]%}"
|
||||||
"
|
echo -n "%{$FX[bold]%}"
|
||||||
PROMPT+="%{$FX[bold]%}"
|
|
||||||
if [[ -n $SSH_CLIENT ]]; then
|
|
||||||
PROMPT+="%{$BG[236]%}"
|
|
||||||
PROMPT+="%{$fg[white]%}$(hostname) "
|
|
||||||
else
|
|
||||||
PROMPT+="%{$BG[234]%}"
|
|
||||||
fi
|
|
||||||
PROMPT+="%{$fg[cyan]%}"
|
|
||||||
PROMPT+="$ "
|
|
||||||
PROMPT+="%{$fg[white]%}"
|
|
||||||
|
|
||||||
# Right side
|
# Show the hostname if this is an SSH session
|
||||||
RPROMPT="%{$fg[cyan]%}"
|
if [[ -n $SSH_CLIENT ]]; then
|
||||||
RPROMPT+='$(short_pwd)'
|
echo -n "$(hostname) "
|
||||||
RPROMPT+='$(git_prompt_info)'
|
fi
|
||||||
RPROMPT+='%{$reset_color%}'
|
|
||||||
|
# The prompt
|
||||||
|
echo -n "\$ %{$FX[no-bold]%}"
|
||||||
|
}
|
||||||
|
|
||||||
|
rprompt() {
|
||||||
|
# Make the rprompt a bright grey to set it apart
|
||||||
|
echo -n "%{$FG[245]%}"
|
||||||
|
echo -n '$(short_pwd)'
|
||||||
|
|
||||||
|
# Show the branch/status if in a git repo
|
||||||
|
echo -n '$(git_prompt)'
|
||||||
|
|
||||||
|
# Reset formatting for command output
|
||||||
|
echo -n "%{$reset_color%}"
|
||||||
|
}
|
||||||
|
|
||||||
|
PROMPT="$(prompt)"
|
||||||
|
RPROMPT="$(rprompt)"
|
||||||
|
|
Loading…
Reference in a new issue