aboutsummaryrefslogtreecommitdiff
path: root/dynamic.txt
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-11-02 16:18:57 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-11-02 16:18:57 +0300
commitd9c587a8d7b22b88fcf340bba182c7a364409f8b (patch)
tree48217491db95876d082b65dd9fe5043286445bb8 /dynamic.txt
parent1b2990ecb3ac2cd5b16aec70c14185fb40cf7df1 (diff)
wip: some churn on dynamic stuff
Diffstat (limited to 'dynamic.txt')
-rw-r--r--dynamic.txt31
1 files changed, 24 insertions, 7 deletions
diff --git a/dynamic.txt b/dynamic.txt
index 45e29dad..4e8d4e84 100644
--- a/dynamic.txt
+++ b/dynamic.txt
@@ -47,12 +47,29 @@ POWERLEVEL9K_DISPLAY_NEW_TTY=(ruler=hide)
POWERLEVEL9K_NEW_TTY_MAX_AGE_SECONDS=5
POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=true
-# $BUFFER  current buffer
-# $1       the first word in $BUFFER after alias expansion
+# $BUFFER   current command line
+# $P9K_COMMAND the first word in $BUFFER after alias expansion
function p10k-on-buffer-change() {
-  if [[ $2 == (|*/)kubectl ]]; then
-    p10k display segment:kubecontext=show
-  else
-    p10k display segment:kubecontext=hide
-  fi
+ 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
+}
+
+function p10k-on-post-prompt() {
+ p10k display line1=hide right=hide segment:time=show
}