optimize prompt_context
This commit is contained in:
parent
c38edde025
commit
724f0e6d50
|
@ -609,11 +609,11 @@ set_default POWERLEVEL9K_ALWAYS_SHOW_USER false
|
||||||
set_default POWERLEVEL9K_CONTEXT_TEMPLATE "%n@%m"
|
set_default POWERLEVEL9K_CONTEXT_TEMPLATE "%n@%m"
|
||||||
prompt_context() {
|
prompt_context() {
|
||||||
local content
|
local content
|
||||||
if [[ $POWERLEVEL9K_ALWAYS_SHOW_CONTEXT == true ]]; then
|
if [[ $POWERLEVEL9K_ALWAYS_SHOW_CONTEXT == true || -z $DEFAULT_USER || -n $SSH_CLIENT || -n $SSH_TTY ]]; then
|
||||||
content=$POWERLEVEL9K_CONTEXT_TEMPLATE
|
content=$POWERLEVEL9K_CONTEXT_TEMPLATE
|
||||||
else
|
else
|
||||||
local user=$(whoami)
|
local user=$(whoami)
|
||||||
if [[ $user != $DEFAULT_USER || -n $SSH_CLIENT || -n $SSH_TTY ]]; then
|
if [[ $user != $DEFAULT_USER ]]; then
|
||||||
content="${POWERLEVEL9K_CONTEXT_TEMPLATE}"
|
content="${POWERLEVEL9K_CONTEXT_TEMPLATE}"
|
||||||
elif [[ $POWERLEVEL9K_ALWAYS_SHOW_USER == true ]]; then
|
elif [[ $POWERLEVEL9K_ALWAYS_SHOW_USER == true ]]; then
|
||||||
content="${user//\%/%%}"
|
content="${user//\%/%%}"
|
||||||
|
|
Loading…
Reference in New Issue