74 lines
1.4 KiB
Bash
74 lines
1.4 KiB
Bash
prompt_pwd() {
|
|
SHORTPWD=`print -Pn "%4~"`
|
|
|
|
if [[ -n "${ZSH_VERSION:-}" ]]
|
|
then _pwd="${SHORTPWD[0,1]}"
|
|
else _pwd="${SHORTPWD:0:1}"
|
|
fi
|
|
|
|
[[ $_pwd =~ "[^/~]" ]] && SHORTPWD=".../$SHORTPWD"
|
|
|
|
echo -n $SHORTPWD
|
|
}
|
|
|
|
prompt_git() {
|
|
if [ "`git_prompt_info`" ]; then
|
|
echo -n "$(git_prompt_info)"
|
|
fi
|
|
}
|
|
|
|
# GIT Stuff
|
|
ZSH_THEME_GIT_PROMPT_PREFIX=" :%{$fg[white]%}"
|
|
ZSH_THEME_GIT_PROMPT_SUFFIX=""
|
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}+%{$fg[white]%}"
|
|
# ZSH_THEME_GIT_PROMPT_CLEAN=""
|
|
|
|
|
|
##################
|
|
# Build Prompt #
|
|
##################
|
|
|
|
prompt_vimode() {
|
|
MODE_INDICATOR="-- COMMAND -- "
|
|
echo -n "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}"
|
|
}
|
|
|
|
prompt() {
|
|
echo -n "%{$FG[242]%}"
|
|
echo -n '$(date "+%H:%M:%S")'
|
|
echo -n "%{$FG[white]%}"
|
|
|
|
# Show the hostname if this is an SSH session
|
|
if [[ -n $SSH_CLIENT ]]; then
|
|
echo -n "%{$fg[blue]%}"
|
|
echo -n " $(hostname)"
|
|
fi
|
|
|
|
# The prompt
|
|
echo -n "%{$fg[red]%}"
|
|
echo -n "%{$FX[bold]%}"
|
|
echo -n ' $ '
|
|
echo -n "%{$reset_color%}"
|
|
|
|
}
|
|
|
|
rprompt() {
|
|
echo -n '$(prompt_vimode)'
|
|
|
|
# Make the rprompt a bright grey to set it apart
|
|
echo -n "%{$FG[245]%}"
|
|
echo -n '$(prompt_pwd)'
|
|
|
|
# Show the branch/status if in a git repo
|
|
echo -n '$(prompt_git)'
|
|
|
|
# Reset formatting for command output
|
|
echo -n "%{$reset_color%}"
|
|
}
|
|
|
|
PROMPT="
|
|
$(prompt)"
|
|
RPROMPT="$(rprompt)"
|
|
|
|
# vim:set ft=zsh:
|