diff --git a/lib/git.zsh b/lib/git.zsh index c8f5da2ea..8c5ee32f0 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -1,7 +1,18 @@ # get the name of the branch we are on function git_prompt_info() { - branch=$(current_branch_for_display) || return - echo "$ZSH_THEME_GIT_PROMPT_PREFIX${branch}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" + local type=${1:-$branch} # ; [[ -n "$type" ]] || type='branch' + + branch=$(current_branch) || return + d_branch="$branch" + case $type in + *abbr*) + d_branch=${branch/master/M} + ;; + esac + + d_commit=''; + + echo "$ZSH_THEME_GIT_PROMPT_PREFIX${d_branch}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" } parse_git_dirty () { diff --git a/themes/alexg.zsh-theme b/themes/alexg.zsh-theme new file mode 100644 index 000000000..dca0ee365 --- /dev/null +++ b/themes/alexg.zsh-theme @@ -0,0 +1,15 @@ +# ZSH Theme - alexg +# Based on 'gallifrey' theme to look like +# git-prompt (http://volnitsky.com/project/git-prompt/) +# +# note: %F and %K dont work correctly on non-color terminals + +local return_code="%(?,,%{$fg[red]%}%? ↵%{$reset_color%})" +local prompt_char="%B%(!,#,»)%b" +local who_where="%(!,%{$fg[magenta]%}%n@%m,%{$fg[blue]%}%m)%{$reset_color%}" + +PROMPT='$(git_prompt_info abbr) $who_where %{$fg[cyan]%}%2~ %{$reset_color%}$prompt_char ' +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"