Allow change the context hostname to display the fqdn.

This commit is contained in:
alysson
2016-02-16 15:51:58 -02:00
parent b71a54db69
commit 5d0b028b7b
2 changed files with 5 additions and 1 deletions

View File

@@ -141,6 +141,7 @@ or don't want to see. All options must be overridden in your **.zshrc** file.
|`BULLETTRAIN_CONTEXT_BG`|`black`|Background color
|`BULLETTRAIN_CONTEXT_FG`|`default`|Foreground color
|`BULLETTRAIN_CONTEXT_DEFAULT_USER`|none|Default user. If you are running with other user other than default, the segment will be showed.
|`BULLETTRAIN_CONTEXT_HOSTNAME`|`%m`|Hostname. Set %M to display the full qualified domain name.
|`BULLETTRAIN_IS_SSH_CLIENT`|none|If `true`, the segment will be showed.
### Python virtualenv (+Pyenv)

View File

@@ -179,6 +179,9 @@ fi
if [ ! -n "${BULLETTRAIN_CONTEXT_FG+1}" ]; then
BULLETTRAIN_CONTEXT_FG=default
fi
if [ ! -n "${BULLETTRAIN_CONTEXT_HOSTNAME+1}" ]; then
BULLETTRAIN_CONTEXT_HOSTNAME=%m
fi
# GIT PROMPT
if [ ! -n "${BULLETTRAIN_GIT_PREFIX+1}" ]; then
@@ -306,7 +309,7 @@ prompt_end() {
# Context: user@hostname (who am I and where am I)
context() {
local user="$(whoami)"
[[ "$user" != "$BULLETTRAIN_CONTEXT_DEFAULT_USER" || -n "$BULLETTRAIN_IS_SSH_CLIENT" ]] && echo -n "${user}@%m"
[[ "$user" != "$BULLETTRAIN_CONTEXT_DEFAULT_USER" || -n "$BULLETTRAIN_IS_SSH_CLIENT" ]] && echo -n "${user}@$BULLETTRAIN_CONTEXT_HOSTNAME"
}
prompt_context() {
[[ $BULLETTRAIN_CONTEXT_SHOW == false ]] && return