my specific zsh prompt

 avatar
unknown
sh
a year ago
603 B
4
Indexable
autoload -U colors && colors
autoload -Uz compinit && compinit

source ~/.zshrc.d/git-prompt.sh

NEWLINE=$'\n'
PROMPT="[%(0?.%{$fg[green]%}OK.%{$fg[red]%}%?)%{$reset_color%}] %{$fg[cyan]%}%~%{$reset_color%} \$(gitprompt)${NEWLINE}%(!.#.\$) "
RPROMPT_BASE="[%{$fg[cyan]%}%*%{$reset_color%}]"
RPROMPT="$RPROMPT_BASE"

function preexec() {
    TIMER=$(date +%s)
}

function precmd(){
    if [ $TIMER ]; then
        now=$(date +%s)
        elapsed=$(($now-$TIMER))
        export RPROMPT="[%{$fg[cyan]%}${elapsed}s%{$reset_color%}] $RPROMPT_BASE"
        unset TIMER now elapsed
    fi
}

export CLICOLOR=1
Editor is loading...
Leave a Comment