diff options
author | June McEnroe <june@causal.agency> | 2015-02-14 16:01:08 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2015-02-14 16:01:08 -0500 |
commit | f9f9d7f5b77f95c9a9dc18df05a332fe37e00533 (patch) | |
tree | 82c408e0d6d34c4847716e2ef22b35eb4bbf1df2 /.zsh/gitprompt.zsh | |
parent | Switch back to gruvbox iTerm theme (diff) | |
download | src-f9f9d7f5b77f95c9a9dc18df05a332fe37e00533.tar.gz src-f9f9d7f5b77f95c9a9dc18df05a332fe37e00533.zip |
Clean up
Diffstat (limited to '')
-rw-r--r-- | .zsh/gitprompt.zsh | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/.zsh/gitprompt.zsh b/.zsh/gitprompt.zsh deleted file mode 100644 index 9e733181..00000000 --- a/.zsh/gitprompt.zsh +++ /dev/null @@ -1,80 +0,0 @@ -# Ported from http://sebastiancelis.com/2009/11/16/zsh-prompt-git-users/ - -function _gitprompt_update { - unset _git_branch - unset _git_status - unset _git_dirty - - local st="$(git status 2> /dev/null)" - if [[ -n "$st" ]]; then - local -a arr - arr=(${(f)st}) - - if [[ $arr[1] =~ 'Not currently on any branch.' ]]; then - _git_branch='none' - else - _git_branch="${arr[1][(w)-1]}" - fi - - if [[ $arr[2] =~ 'Your branch is' ]]; then - if [[ $arr[2] =~ 'ahead' ]]; then - _git_status='ahead' - elif [[ $arr[2] =~ 'diverged' ]]; then - _git_status='diverged' - elif [[ $arr[2] =~ 'behind' ]]; then - _git_status='behind' - fi - fi - - if [[ ! $st =~ 'nothing' ]]; then - _git_dirty=1 - fi - fi -} - -function gitprompt { - if [[ -n "$_git_branch" ]]; then - local s - [[ -z "$1" ]] && s="%{${fg[yellow]}%}" - - if [[ -n "$_git_dirty" ]]; then - s+="⚡" - else - s+=":" - fi - - s+="$_git_branch" - case "$_git_status" in - ahead) - s+="↑" - ;; - diverged) - s+="↕" - ;; - behind) - s+="↓" - ;; - esac - - echo "$s" - fi -} - -function _gitprompt_preexec { - [[ "$1" =~ "^g" ]] && _git_command=1 -} - -function _gitprompt_precmd { - if [[ -n "$_git_command" ]]; then - _gitprompt_update - unset _git_command - fi -} - -typeset -ga preexec_functions -typeset -ga precmd_functions -typeset -ga chpwd_functions - -preexec_functions+='_gitprompt_preexec' -precmd_functions+='_gitprompt_precmd' -chpwd_functions+='_gitprompt_update' |