Add custom segment

This commit is contained in:
Caio Gondim
2015-12-10 17:50:25 +01:00
parent 3f5691e1fc
commit a327f67f96
2 changed files with 29 additions and 0 deletions

View File

@@ -129,6 +129,14 @@ or don't want to see. All options must be overridden in your **.zshrc** file.
|`BULLETTRAIN_TIME_BG`|`''`|Background color |`BULLETTRAIN_TIME_BG`|`''`|Background color
|`BULLETTRAIN_TIME_FG`|`''`|Foreground color |`BULLETTRAIN_TIME_FG`|`''`|Foreground color
### Custom
|Variable|Default|Meaning
|--------|-------|-------|
|`BULLETTRAIN_CUSTOM_MSG`|`false`|Free segment you can put a custom message
|`BULLETTRAIN_CUSTOM_BG`|`black`|Background color
|`BULLETTRAIN_CUSTOM_FG`|`black`|Foreground color
### Context ### Context
|Variable|Default|Meaning |Variable|Default|Meaning

View File

@@ -57,6 +57,17 @@ if [ ! -n "${BULLETTRAIN_TIME_FG+1}" ]; then
BULLETTRAIN_TIME_FG=black BULLETTRAIN_TIME_FG=black
fi fi
# CUSTOM
if [ ! -n "${BULLETTRAIN_CUSTOM_MSG+1}" ]; then
BULLETTRAIN_CUSTOM_MSG=false
fi
if [ ! -n "${BULLETTRAIN_CUSTOM_BG+1}" ]; then
BULLETTRAIN_CUSTOM_BG=black
fi
if [ ! -n "${BULLETTRAIN_CUSTOM_FG+1}" ]; then
BULLETTRAIN_CUSTOM_FG=default
fi
# VIRTUALENV # VIRTUALENV
if [ ! -n "${BULLETTRAIN_VIRTUALENV_SHOW+1}" ]; then if [ ! -n "${BULLETTRAIN_VIRTUALENV_SHOW+1}" ]; then
BULLETTRAIN_VIRTUALENV_SHOW=true BULLETTRAIN_VIRTUALENV_SHOW=true
@@ -286,6 +297,15 @@ prompt_context() {
[[ -n "$_context" ]] && prompt_segment $BULLETTRAIN_CONTEXT_BG $BULLETTRAIN_CONTEXT_FG "$_context" [[ -n "$_context" ]] && prompt_segment $BULLETTRAIN_CONTEXT_BG $BULLETTRAIN_CONTEXT_FG "$_context"
} }
# Custom
prompt_custom() {
if [[ $BULLETTRAIN_CUSTOM_MSG == false ]]; then
return
fi
prompt_segment $BULLETTRAIN_CUSTOM_BG $BULLETTRAIN_CUSTOM_FG "${BULLETTRAIN_CUSTOM_MSG}"
}
# Git # Git
prompt_git() { prompt_git() {
if [[ $BULLETTRAIN_GIT_SHOW == false ]]; then if [[ $BULLETTRAIN_GIT_SHOW == false ]]; then
@@ -508,6 +528,7 @@ build_prompt() {
RETVAL=$? RETVAL=$?
prompt_time prompt_time
prompt_status prompt_status
prompt_custom
prompt_context prompt_context
prompt_dir prompt_dir
prompt_ruby prompt_ruby