Created
October 17, 2012 15:29
-
-
Save geta6/3906156 to your computer and use it in GitHub Desktop.
Git-Prompt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Git Prompt | |
# | |
__git_files() { _files } | |
autoload -Uz add-zsh-hook | |
autoload -Uz vcs_info | |
zstyle ':vcs_info:*' enable git svn hg bzr | |
zstyle ':vcs_info:*' formats '(%s)-[%b]' | |
zstyle ':vcs_info:*' actionformats '(%s)-[%b|%a]' | |
zstyle ':vcs_info:(svn|bzr):*' branchformat '%b:r%r' | |
zstyle ':vcs_info:bzr:*' use-simple true | |
autoload -Uz is-at-least | |
if is-at-least 4.3.10; then | |
zstyle ':vcs_info:git:*' check-for-changes true | |
zstyle ':vcs_info:git:*' stagedstr "^" | |
zstyle ':vcs_info:git:*' unstagedstr "*" | |
zstyle ':vcs_info:git:*' formats '[%s](%b) %c%u' | |
zstyle ':vcs_info:git:*' actionformats '[%s](%b|%a) %c%u' | |
fi | |
function _update_vcs_info_msg() { | |
psvar=() | |
LANG=en_US.UTF-8 vcs_info | |
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_" | |
} | |
add-zsh-hook precmd _update_vcs_info_msg | |
RPROMPT="%1(v|%F{green}%1v%f|)" | |
RPROMPT="$RPROMPT %{${fg[blue]}%}[%/]%{${reset_color}%}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment