Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose prompt character color variables #115

Merged
merged 2 commits into from Aug 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Expand Up @@ -219,6 +219,14 @@ SPACESHIP_PROMPT_ORDER=(
| `SPACESHIP_PROMPT_DEFAULT_PREFIX` | `via ` | Default prefix for prompt sections |
| `SPACESHIP_PROMPT_DEFAULT_SUFFIX` | ` ` | Default suffix for prompt section |

### Char

| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_CHAR_SUCCESS_COLOR` | `green` | Color of prompt character if last command completes successfully |
| `SPACESHIP_CHAR_FAILURE_COLOR` | `red` | Color of prompt character if last command returns non-zero exit-code |
| `SPACESHIP_CHAR_SECONDARY_COLOR` | `yellow` | Color of secondary prompt character |

### Time (`time`)

Disabled as default. Set `SPACESHIP_TIME_SHOW` to `true` in your `.zshrc`, if you need to show time stamps.
Expand Down Expand Up @@ -687,6 +695,11 @@ SPACESHIP_PROMPT_SUFFIXES_SHOW=true
SPACESHIP_PROMPT_DEFAULT_PREFIX="via "
SPACESHIP_PROMPT_DEFAULT_SUFFIX=" "

# CHAR
SPACESHIP_CHAR_SUCCESS_COLOR="green"
SPACESHIP_CHAR_FAILURE_COLOR="red"
SPACESHIP_CHAR_SECONDARY_COLOR="yellow"

# TIME
SPACESHIP_TIME_SHOW=false
SPACESHIP_TIME_PREFIX="at "
Expand Down
9 changes: 7 additions & 2 deletions spaceship.zsh
Expand Up @@ -63,6 +63,11 @@ SPACESHIP_PROMPT_SUFFIXES_SHOW="${SPACESHIP_PROMPT_SUFFIXES_SHOW:=true}"
SPACESHIP_PROMPT_DEFAULT_PREFIX="${SPACESHIP_PROMPT_DEFAULT_PREFIX:="via "}"
SPACESHIP_PROMPT_DEFAULT_SUFFIX="${SPACESHIP_PROMPT_DEFAULT_SUFFIX:=" "}"

# CHAR
SPACESHIP_CHAR_SUCCESS_COLOR="${SPACESHIP_CHAR_SUCCESS_COLOR:=green}"
SPACESHIP_CHAR_FAILURE_COLOR="${SPACESHIP_CHAR_FAILURE_COLOR:=red}"
SPACESHIP_CHAR_SECONDARY_COLOR="${SPACESHIP_CHAR_SECONDARY_COLOR:=yellow}"

# TIME
SPACESHIP_TIME_SHOW="${SPACESHIP_TIME_SHOW:=false}"
SPACESHIP_TIME_PREFIX="${SPACESHIP_TIME_PREFIX:="at "}"
Expand Down Expand Up @@ -1236,7 +1241,7 @@ spaceship_line_sep() {
# Paint $PROMPT_SYMBOL in red if previous command was fail and
# paint in green if everything was OK.
spaceship_char() {
_prompt_section "%(?.green.red)" "${SPACESHIP_PROMPT_SYMBOL} "
_prompt_section "%(?.$SPACESHIP_CHAR_SUCCESS_COLOR.$SPACESHIP_CHAR_FAILURE_COLOR)" "${SPACESHIP_PROMPT_SYMBOL} "
}

# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -1274,7 +1279,7 @@ spaceship_prompt() {

# PS2 - continuation interactive prompt
spaceship_ps2() {
_prompt_section "yellow" $SPACESHIP_PROMPT_SYMBOL
_prompt_section "$SPACESHIP_CHAR_SECONDARY_COLOR" $SPACESHIP_PROMPT_SYMBOL
}

# Setup required environment variables
Expand Down