+# Setup the prompt with pretty colors
+setopt prompt_subst
+autoload colors; colors;
+
hostcolor=green
[[ $(hostname) == "tardis" ]] && hostcolor=red
precmd() {
- PROMPT='%T %n@%{$fg[$hostcolor]%}%m%{$reset_color%}%-0>..>$(git_prompt_status)%>>
-%(?..%{$fg_bold[white]%}%?%{$reset_color%})$(vi_prompt_info)%{%(!.$fg[red]❰.$fg[green]❱)%1G%} '
+ PROMPT='%T %n@%{$fg[$hostcolor]%}%m%(1j. $fg_bold[white]↵%{$fg_bold[red]%}%j.)%{$reset_color%}%-0>..>$(git_prompt_status)%>>
+%(?..%{$fg_bold[white]%}%?)%{$reset_color%}$(vi_prompt_info)%{%(!.$fg[red]❰.$fg[green]❱)%1G%} '
RPROMPT='%{$fg[green]%}%~%{$reset_color%}'
}
vi_prompt_info() {
local vicmd="$fg_bold[green]❰$reset_color%1G"
local viins="$fg_bold[blue]❱$reset_color%1G"
- printf '%s' "%{${${KEYMAP/vicmd/$vicmd}/(main|viins)/$viins}%}"
+ local map=${KEYMAP:-viins}
+ printf '%s' "%{${${map/vicmd/$vicmd}/(main|viins)/$viins}%}"
}
function zle-line-init zle-line-finish zle-keymap-select {
zle -R
}
-zle -N zle-line-init
-zle -N zle-line-finish
+# zle -N zle-line-init
+# zle -N zle-line-finish
zle -N zle-keymap-select
# reset zle on resize
# Get current status.
while IFS=$'\n' read line; do
if [[ "$line" == \#\#\ * ]]; then
- [[ "$line" =~ '## ([^.]*)\.\.\.(.*)' ]] && branch=$match[1]
- [[ "$line" =~ 'ahead ([0-9]+)' ]] && ahead=$match[1]
- [[ "$line" =~ 'behind ([0-9]+)' ]] && behind=$match[1]
+ [[ "$line" =~ '## (.*?)(\.\.\.|$)' ]] && branch=$match[1]
+ [[ "$line" =~ 'ahead ([0-9]+)' ]] && ahead=$match[1]
+ [[ "$line" =~ 'behind ([0-9]+)' ]] && behind=$match[1]
else
# Count added, deleted, modified, renamed, unmerged, untracked, dirty.
# T (type change) is undocumented, see http://git.io/FnpMGw.