diff options
Diffstat (limited to 'dot-oh-my-zsh/custom/themes/spaceship-prompt/sections/git_branch.zsh')
| -rw-r--r-- | dot-oh-my-zsh/custom/themes/spaceship-prompt/sections/git_branch.zsh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/dot-oh-my-zsh/custom/themes/spaceship-prompt/sections/git_branch.zsh b/dot-oh-my-zsh/custom/themes/spaceship-prompt/sections/git_branch.zsh new file mode 100644 index 00000000..99ff82c2 --- /dev/null +++ b/dot-oh-my-zsh/custom/themes/spaceship-prompt/sections/git_branch.zsh @@ -0,0 +1,31 @@ +# +# Git branch +# +# Show current git branch + +# ------------------------------------------------------------------------------ +# Configuration +# ------------------------------------------------------------------------------ + +SPACESHIP_GIT_BRANCH_SHOW="${SPACESHIP_GIT_BRANCH_SHOW=true}" +SPACESHIP_GIT_BRANCH_PREFIX="${SPACESHIP_GIT_BRANCH_PREFIX="$SPACESHIP_GIT_SYMBOL"}" +SPACESHIP_GIT_BRANCH_SUFFIX="${SPACESHIP_GIT_BRANCH_SUFFIX=""}" +SPACESHIP_GIT_BRANCH_COLOR="${SPACESHIP_GIT_BRANCH_COLOR="magenta"}" + +# ------------------------------------------------------------------------------ +# Section +# ------------------------------------------------------------------------------ + +spaceship_git_branch() { + [[ $SPACESHIP_GIT_BRANCH_SHOW == false ]] && return + + local git_current_branch="$vcs_info_msg_0_" + [[ -z "$git_current_branch" ]] && return + + git_current_branch="${git_current_branch#heads/}" + git_current_branch="${git_current_branch/.../}" + + spaceship::section \ + "$SPACESHIP_GIT_BRANCH_COLOR" \ + "$SPACESHIP_GIT_BRANCH_PREFIX${git_current_branch}$SPACESHIP_GIT_BRANCH_SUFFIX" +} |
