Skip to content

Commit

Permalink
add BULLETTRAIN_GIT_COLORIZE_DIRTY to show yellow BG when git repo is…
Browse files Browse the repository at this point in the history
… dirty

this feature is borrowed from agnoster
https://gist.github.com/agnoster/3712874#file-agnoster-zsh-theme-L82
  • Loading branch information
timfeirg committed Nov 30, 2015
1 parent d438f5d commit a00dbb2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ or don't want to see. All options must be overridden in your **.zshrc** file.
|Variable|Default|Meaning
|--------|-------|-------|
|`BULLETTRAIN_GIT_SHOW`|`true`|Show/hide that segment
|`BULLETTRAIN_GIT_COLORIZE_DIRTY`|`false`|Set BULLETTRAIN_GIT_BG to yellow in dirty state
|`BULLETTRAIN_GIT_BG`|`white`|Background color
|`BULLETTRAIN_GIT_FG`|`black`|Foreground color
|`BULLETTRAIN_GIT_EXTENDED`|`true`|
Expand Down
6 changes: 6 additions & 0 deletions bullet-train.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ fi
if [ ! -n "${BULLETTRAIN_GIT_SHOW+1}" ]; then
BULLETTRAIN_GIT_SHOW=true
fi
if [ ! -n "${BULLETTRAIN_GIT_COLORIZE_DIRTY+1}" ]; then
BULLETTRAIN_GIT_COLORIZE_DIRTY=false
fi
if [ ! -n "${BULLETTRAIN_GIT_BG+1}" ]; then
BULLETTRAIN_GIT_BG=white
fi
Expand Down Expand Up @@ -290,6 +293,9 @@ prompt_git() {
repo_path=$(git rev-parse --git-dir 2>/dev/null)

if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
if [[ $BULLETTRAIN_GIT_COLORIZE_DIRTY == true && $(git status --porcelain --ignore-submodules) ]]; then
BULLETTRAIN_GIT_BG=yellow
fi
prompt_segment $BULLETTRAIN_GIT_BG $BULLETTRAIN_GIT_FG

if [[ $BULLETTRAIN_GIT_EXTENDED == true ]]; then
Expand Down

0 comments on commit a00dbb2

Please sign in to comment.