From: Frank Terbeck Date: Fri, 29 Aug 2008 17:50:36 +0000 (+0200) Subject: Introduce a disable style to vcs_info() X-Git-Tag: 0.3.53~4 X-Git-Url: http://git.grml.org/?a=commitdiff_plain;h=f0e18fbd58fa624ba949a775260fd5e1b180e479;p=grml-etc-core.git Introduce a disable style to vcs_info() Give the user the opportunity to switch the vcs_info prompt off for certain version control systems. Plus documentation update for vcs_info(), including examples. --- diff --git a/debian/changelog b/debian/changelog index 4f12d95..b7e70e2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,8 +6,10 @@ grml-etc-core (0.3.53) unstable; urgency=low vcs to 'git-svn' * zshrc: Handle .hg subdirectories, that are not the .hg subdirectory of a mercurial repository. Found by Karl Voit. + * zshrc: Give the user the opportunity to switch the vcs_info prompt + off for certain version control systems. - -- Frank Terbeck Fri, 29 Aug 2008 19:08:28 +0200 + -- Frank Terbeck Fri, 29 Aug 2008 19:46:35 +0200 grml-etc-core (0.3.52) unstable; urgency=low diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 0bb49ad..6488a51 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -1053,6 +1053,9 @@ fi # (like an interactive rebase or a merge conflict) # enable - check in the 'init' context. If set to false, # vcs_info() will do nothing. +# disable - provide a list of systems, you don't want +# the prompt to check for repositories (checked +# in the 'init' context, too). # # The default values for these in all contexts are: # promptformat " (%s)-[%b|%a]-" @@ -1070,8 +1073,19 @@ fi # # Not all vcs backends may support all replacements # +# Examples: +# Don't use vcs_info at all (even though it's in your prompt): +# % zstyle ':vcs_info:*' enable false +# +# Don't provide prompt info for bzr and svk: +# % zstyle ':vcs_info:*' disable bzr svk +# +# Provide a prompt specifically for git: +# % zstyle ':vcs_info:git' promptformat ' GIT, BABY! [%b]' +# % zstyle ':vcs_info:git' promptactionformat ' GIT ACTION! [%b|%a]' +# # If you want colors, make sure you enclose the color codes in %{...%}, because -# the string provided by vcs_info() is commonly used for prompts. +# the string provided by vcs_info() is used for prompts. # # Example: PROMPT='%(?..[%?]-)%3~%$(vcs_info)#' # @@ -1338,17 +1352,19 @@ VCS_INFO_svn_detect() { vcs_info () { # {{{ local string local -i found - local -a VCSs + local -a VCSs disabled local -x vcs local -Ax vcs_comm vcs="init" zstyle -T ":vcs_info:${vcs}" "enable" || return 0 + zstyle -a ":vcs_info:${vcs}" "disable" disabled VCSs=(git hg bzr svn svk) (( found = 0 )) for vcs in ${VCSs} ; do + [[ -n ${(M)disabled:#${vcs}} ]] && continue vcs_comm=() VCS_INFO_${vcs}_detect && (( found = 1 )) && break done