2019-10-29 14:55:36 +00:00
|
|
|
|
p10k display
|
|
|
|
|
dir=short|long|auto
|
|
|
|
|
right=hide|show
|
|
|
|
|
empty_line=print|show|hide
|
|
|
|
|
ruler=print|show|hide
|
|
|
|
|
segment:kubecontext=show|hide
|
|
|
|
|
gap=show|hide
|
2019-10-29 15:49:40 +00:00
|
|
|
|
line1=show|hide
|
2019-10-29 14:55:36 +00:00
|
|
|
|
|
|
|
|
|
`print` controls all future prompts; it's weird to use it in POWERLEVEL9K_DISPLAY_PAST but it's not contradictory
|
|
|
|
|
|
|
|
|
|
# default values
|
|
|
|
|
POWERLEVEL9K_DISPLAY_NEW_TTY=()
|
|
|
|
|
POWERLEVEL9K_DISPLAY_CURRENT=()
|
|
|
|
|
POWERLEVEL9K_DISPLAY_PAST=()
|
|
|
|
|
POWERLEVEL9K_NEW_TTY_MAX_AGE_SECONDS=inf
|
|
|
|
|
|
|
|
|
|
# new way to show empty line
|
|
|
|
|
POWERLEVEL9K_DISPLAY_NEW_TTY=(empty_line=hide)
|
|
|
|
|
POWERLEVEL9K_DISPLAY_CURRENT=(empty_line=print)
|
|
|
|
|
POWERLEVEL9K_NEW_TTY_MAX_AGE_SECONDS=5
|
|
|
|
|
|
|
|
|
|
# deprecated.
|
|
|
|
|
POWERLEVEL9K_SHOW_RULER
|
|
|
|
|
POWERLEVEL9K_PROMPT_ADD_NEWLINE
|
|
|
|
|
|
|
|
|
|
if POWERLEVEL9K_PROMPT_ADD_NEWLINE is true; then
|
|
|
|
|
if any of the new flags are set {
|
|
|
|
|
print a warning and do nothing
|
|
|
|
|
} else {
|
|
|
|
|
POWERLEVEL9K_DISPLAY_NEW_TTY=(empty_line=hide)
|
|
|
|
|
POWERLEVEL9K_DISPLAY_CURRENT=(empty_line=print)
|
|
|
|
|
}
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if POWERLEVEL9K_SHOW_RULER is true; then
|
|
|
|
|
if any of the new flags are set {
|
|
|
|
|
print a warning and do nothing
|
|
|
|
|
} else {
|
|
|
|
|
POWERLEVEL9K_DISPLAY_CURRENT=(ruler=show)
|
|
|
|
|
}
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
POWERLEVEL9K_DISPLAY_CURRENT=(ruler=show segment:kubecontext=hide segment:time=hide)
|
|
|
|
|
POWERLEVEL9K_DISPLAY_PAST=(ruler=hide segment:time=show)
|
|
|
|
|
POWERLEVEL9K_DISPLAY_NEW_TTY=(ruler=hide)
|
|
|
|
|
POWERLEVEL9K_NEW_TTY_MAX_AGE_SECONDS=5
|
|
|
|
|
POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=true
|
|
|
|
|
|
2019-11-02 13:18:57 +00:00
|
|
|
|
# $BUFFER current command line
|
|
|
|
|
# $P9K_COMMAND the first word in $BUFFER after alias expansion
|
2019-10-29 14:55:36 +00:00
|
|
|
|
function p10k-on-buffer-change() {
|
2019-11-02 13:18:57 +00:00
|
|
|
|
case ${P9K_COMMAND:t} in
|
|
|
|
|
kubectl) p10k display segment:kubecontext=show;;
|
|
|
|
|
az) p10k display segment:azure=show;;
|
|
|
|
|
terraform) p10k display segment:azure=show segment:kubecontext=show;;
|
|
|
|
|
*) p10k display segment:azure=hide segment:kubecontext=hide;;
|
|
|
|
|
esac
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# $P9K_PROMPT_TYPE instant|regular
|
|
|
|
|
# $P9K_TTY_TYPE new|old
|
|
|
|
|
function p10k-on-pre-prompt() {
|
|
|
|
|
p10k display segment:kubecontext=hide segment:azure=hide
|
|
|
|
|
p10k display line1=show right=show segment:time=hide
|
|
|
|
|
if [[ $P9K_TTY_TYPE == new ]]; then
|
|
|
|
|
p10k display empty_line=hide
|
|
|
|
|
else
|
|
|
|
|
p10k display empty_line=show
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-02 18:03:45 +00:00
|
|
|
|
${_p9k__'$_p9k_line_index'r-'$right'}
|
|
|
|
|
|
2019-11-02 13:18:57 +00:00
|
|
|
|
function p10k-on-post-prompt() {
|
|
|
|
|
p10k display line1=hide right=hide segment:time=show
|
2019-10-29 14:55:36 +00:00
|
|
|
|
}
|
2019-11-02 18:03:45 +00:00
|
|
|
|
|
|
|
|
|
TODO: support -1/left
|
|
|
|
|
TODO: hiding gap kills right prompt; this is bad; implement it like ruler, with 3 values in _p9k_t?
|
|
|
|
|
TODO: add 1/right/frame
|
|
|
|
|
|
|
|
|
|
empty_line
|
|
|
|
|
ruler
|
|
|
|
|
1
|
|
|
|
|
1/gap
|
|
|
|
|
1/left
|
|
|
|
|
1/right
|
|
|
|
|
1/right/time
|