autoload -U compinit promptinit -U colors && colors autoload -z edit-command-line bindkey -e compinit promptinit HISTSIZE=10000 SAVEHIST=10000 HISTFILE=~/.zsh_history setopt inc_append_history setopt share_history setopt extended_history setopt prompt_subst zle -N edit-command-line bindkey "^X^E" edit-command-line alias ls='ls --color=auto' alias grep='grep --color=auto' if [[ "${TERM}" == "dumb" ]]; then unsetopt zle unsetopt prompt_cr unsetopt prompt_subst if whence -w precmd >/dev/null; then unfunction precmd fi if whence -w preexec >/dev/null; then unfunction preexec fi PS1="$ " return fi prompt_char() { branch=$(git branch 2> /dev/null | grep \* | awk '{print $2}') if [[ ${branch} ]]; then gp="[%{$fg[magenta]%}${branch}" if [ `git status --porcelain 2> /dev/null | wc -l` -ne 0 ]; then gp="${gp}%{$reset_color%}(%{$fg[green]%}ϟ%{$reset_color%})" fi gp="${gp}%{$reset_color%}]±" echo ${gp} return fi echo "%%" } PROMPT='(@%m)(%1~)$(prompt_char) ' rprompt_precmd() { if [[ $? -ne 0 ]]; then RPROMPT="(%{$fg[red]%}%?%{$reset_color%})" else RPROMPT="" fi } precmd_functions+=(rprompt_precmd) eval "$(direnv hook zsh)"