Timebox the git status checks inside prompt so slow repos don't hang the zsh prompt.

Give "robbyrussell" them support for the timed-out check.

Uses zsh's `coproc` to put a timeout on the `git status` call inside git_prompt_info()
Introduces $ZSH_THEME_GIT_PROMPT_TIMEDOUT and $ZSH_THEME_SCM_CHECK_TIMEOUT theme configuration variables to control how long the timeout is and how the timed-out indicator appears inside the prompt.
This commit is contained in:
Andrew Janke 2015-03-26 17:53:02 -04:00
commit 3efa6ceddd
3 changed files with 22 additions and 6 deletions

View file

@ -39,6 +39,11 @@ ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of th
ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt
ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty
ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean
ZSH_THEME_GIT_PROMPT_TIMEDOUT="?" # Text to display if status check timed out
# Timeout (in seconds, fractions OK) for SCM (git/hg/etc) info checks done
# inside prompt
ZSH_THEME_SCM_CHECK_TIMEOUT=1
# Setup the prompt with pretty colors
setopt prompt_subst