From 9ff70c1e848affebae77cf3a275576350e974c23 Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Tue, 18 Apr 2017 09:45:10 +0200 Subject: zsh: use vcs_info rather then a manual git_prompt_info --- .zsh/prompt | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.zsh/prompt b/.zsh/prompt index 17e578d..5ee9c3f 100644 --- a/.zsh/prompt +++ b/.zsh/prompt @@ -1,14 +1,20 @@ -# functions -function git_prompt_info { - git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' -} - # Load colors autoload -U colors && colors +precmd() { + vcs_info +} + setopt promptsubst -local CUR_BRANCH='$(git_prompt_info)' -PROMPT="%{$fg[blue]%}[%{$fg[yellow]%}%n%{$fg[blue]%}@%{$fg[green]%}%m%{$fg[yellow]%}:%~%{$fg[blue]%}]%{$fg[red]%}${CUR_BRANCH}%{$fg[green]%}%# %{$reset_color%}" +zstyle ':vcs_info:*' enable git svn +zstyle ':vcs_info:*' check-for-changes true +zstyle ':vcs_info:*' get-revision true +zstyle ':vcs_info:*' get-bookmarks true +zstyle ':vcs_info:git:*' formats "%{$fg[blue]%}(%{$fg[cyan]%}%s%{$fg[blue]%}:%{$fg[yellow]%}%10>>%i%<<%{$fg[blue]%}) %{$fg[red]%}%b$fg[magenta]%}%m%u%c"$'\n' +zstyle ':vcs_info:git:*' actionformats "%{$fg[blue]%}(%{$fg[cyan]%}%s%{$fg[blue]%}:%{$fg[yellow]%}%10>>%i%<<%{$fg[blue]%}) %{$fg[red]%}%b %{$fg[blue]%}[$fg[green]%}%a%{$fg[blue]%}]"$'\n' +zstyle ':vcs_info:git:*' branchformat ' GIT BRANCH: %b' + +PROMPT='${vcs_info_msg_0_}%{$fg[blue]%}[%{$fg[cyan]%}%n%{$fg[blue]%}@%{$fg[magenta]%}%m%{$fg[yellow]%}:%~%{$fg[blue]%}]%{$fg[green]%}%# %{$reset_color%}' -RPROMPT='[%?]' +RPROMPT='[%?%^]' -- cgit v0.12