@@ -7,10 +7,11 @@ local grep_color="auto" local ls="" local ls_color="auto" local ls_on_cd="yes" local ls_on_init="no" +local simple_prompt="no" bindkey -v # history-incremental-search-backward is much more useful than # _history-complete-* bindkey "^R" history-incremental-search-backward @@ -65,26 +66,39 @@ *) __update_terminal_cwd() {} ;; esac -set_prompt() { - PS1="%F{23}%m %F{29}%c$1%F{36}%(!.#.>)%f " - PS2="%B>%b " - RPS1="%(1j.%F{yellow}%j%f.)%(?..%(1j. .)%F{red}%?%f)" - RPS2="%(1_.%F{black}%B(%_%)%b%f.)" -} +if [ "$simple_prompt" = yes ]; then + set_prompt() { + local branch + [ -n "$1" ] && branch="%F{black}%B(%b%F{cyan}$1%F{black}%B)%b%f" + + PS1="%m:%c$branch%B%(!.#.$)%b " + PS2="%B>%b " + RPS1="%(1j.%F{yellow}%j%f.)%(?..%(1j. .)%F{red}%?%f)" + RPS2="%(1_.%F{black}%B(%_%)%b%f.)" + } +else + set_prompt() { + local branch + [ -n "$1" ] && branch="%F{36}(%F{78}$1%F{36})" + + PS1="%F{23}%m %F{29}%c$branch%F{36}%(!.#.>)%f " + PS2="%B>%b " + RPS1="%(1j.%F{yellow}%j%f.)%(?..%(1j. .)%F{red}%?%f)" + RPS2="%(1_.%F{black}%B(%_%)%b%f.)" + } +fi set_prompt __precmd() { __update_terminal_cwd - local branch_name=$(git symbolic-ref HEAD 2>/dev/null) - branch_name=${branch_name##refs/heads/} - if [ -n "$branch_name" -a "$branch_name" != master ]; then - local branch="%F{36}(%F{78}$branch_name%F{36})" - fi + local branch=$(git symbolic-ref HEAD 2>/dev/null) + branch=${branch##refs/heads/} + [ "$branch" = master ] && branch="" set_prompt $branch } case $TERM in aterm|Eterm|rxvt*|uxterm*|xterm*) @@ -199,7 +213,7 @@ alias pws="__pw -k ~/.cryptopassphrase-server.key" ixio() { curl -F 'f:1=<-' ix.io } 0x0st() { curl -F'file=@-' https://0x0.st } -unset fgrep grep grep_color ls ls_color ls_on_cd ls_on_init +unset fgrep grep grep_color ls ls_color ls_on_cd ls_on_init simple_prompt unset HISTFILE