From ac6adbd425fc72c73b50acba3531e312c1a3fd97 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 19 Mar 2021 15:30:19 +0100 Subject: [PATCH] Add dir to sentient line, fix git branch length --- zsh/.p10k.zsh | 47 +++++++++++++++++++++++++++-------------------- zsh/.zshrc | 2 +- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/zsh/.p10k.zsh b/zsh/.p10k.zsh index a9d2f93..5b34802 100644 --- a/zsh/.p10k.zsh +++ b/zsh/.p10k.zsh @@ -43,6 +43,7 @@ # =========================[ Line #2 ]========================= newline time + dir prompt_char # prompt symbol ) @@ -57,7 +58,7 @@ background_jobs # presence of background jobs direnv # direnv status (https://direnv.net/) virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html) - anaconda # conda environment (https://conda.io/) + # anaconda # conda environment (https://conda.io/) pyenv # python environment (https://github.com/pyenv/pyenv) goenv # go environment (https://github.com/syndbg/goenv) nodenv # node.js version from nodenv (https://github.com/nodenv/nodenv) @@ -67,31 +68,32 @@ # go_version # go version (https://golang.org) # rust_version # rustc version (https://www.rust-lang.org) # dotnet_version # .NET version (https://dotnet.microsoft.com) - rbenv # ruby version from rbenv (https://github.com/rbenv/rbenv) - rvm # ruby version from rvm (https://rvm.io) - fvm # flutter version management (https://github.com/leoafarias/fvm) - luaenv # lua version from luaenv (https://github.com/cehoffman/luaenv) - jenv # java version from jenv (https://github.com/jenv/jenv) - plenv # perl version from plenv (https://github.com/tokuhirom/plenv) + # rbenv # ruby version from rbenv (https://github.com/rbenv/rbenv) + # rvm # ruby version from rvm (https://rvm.io) + # fvm # flutter version management (https://github.com/leoafarias/fvm) + # luaenv # lua version from luaenv (https://github.com/cehoffman/luaenv) + # jenv # java version from jenv (https://github.com/jenv/jenv) + # plenv # perl version from plenv (https://github.com/tokuhirom/plenv) kubecontext # current kubernetes context (https://kubernetes.io/) terraform # terraform workspace (https://www.terraform.io) - aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) - aws_eb_env # aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) - azure # azure account name (https://docs.microsoft.com/en-us/cli/azure) + # aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) + # aws_eb_env # aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) + # azure # azure account name (https://docs.microsoft.com/en-us/cli/azure) gcloud # google cloud cli acccount and project (https://cloud.google.com/) google_app_cred # google application credentials (https://cloud.google.com/docs/authentication/production) context # user@hostname - nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) - ranger # ranger shell (https://github.com/ranger/ranger) - nnn # nnn shell (https://github.com/jarun/nnn) + # nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) + # ranger # ranger shell (https://github.com/ranger/ranger) + # nnn # nnn shell (https://github.com/jarun/nnn) vim_shell # vim shell indicator (:sh) midnight_commander # midnight commander shell (https://midnight-commander.org/) vi_mode # vi mode (you don't need this if you've enabled prompt_char) # vpn_ip # virtual private network indicator - # ram # free RAM - # load # CPU load + ram # free RAM + load # CPU load todo # todo items (https://github.com/todotxt/todo.txt-cli) time # current time + battery # =========================[ Line #2 ]========================= newline # public_ip # public IP address @@ -299,6 +301,7 @@ # Show this icon when the current directory is not writable. POWERLEVEL9K_DIR_SHOW_WRITABLE # above must be set to true for this parameter to have effect. # typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐' + typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='✖️' # Custom prefix. # typeset -g POWERLEVEL9K_DIR_PREFIX='%250Fin ' @@ -400,7 +403,7 @@ # If local branch name or tag is at most 32 characters long, show it in full. # Otherwise show the first 12 … the last 12. - (( $#where > 32 )) && where[13,-13]="…" + (( $#where > 80 )) && where[12,-64]="…" res+="${clean}${where//\%/%%}" # escape % # Display the current Git commit if there is no branch or tag. @@ -1090,9 +1093,13 @@ prompt_example } - function p10k-on-pre-prompt() { p10k display '1|2/right'=show '2/left/time'=hide } - - function p10k-on-post-prompt() { p10k display '1|2/right'=hide '2/left/time'=show } + # CUSTOM this replaces the transient prompt function + # see https://www.reddit.com/r/zsh/comments/dsh1g3/new_powerlevel10k_feature_transient_prompt/f6w9ept/ + # and https://github.com/romkatv/powerlevel10k/issues/316#issuecomment-551867287 + # first disable line 1 and line 2 right part then enable time and dir on line 2 left side + # make sure they are enabled in POWERLEVEL9K_LEFT_PROMPT_ELEMENTS, otherwise show/hide has no effect + function p10k-on-pre-prompt() { p10k display '1|2/right'=show '2/left/time'=hide '2/left/dir'=hide } + function p10k-on-post-prompt() { p10k display '1|2/right'=hide '2/left/time'=show '2/left/dir'=show } # User-defined prompt segments can be customized the same way as built-in segments. # typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=208 @@ -1117,7 +1124,7 @@ # - verbose: Enable instant prompt and print a warning when detecting console output during # zsh initialization. Choose this if you've never tried instant prompt, haven't # seen the warning, or if you are unsure what this all means. - typeset -g POWERLEVEL9K_INSTANT_PROMPT=off + typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized. # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload diff --git a/zsh/.zshrc b/zsh/.zshrc index fde8d3a..26eab5d 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -9,7 +9,7 @@ fi # export PATH=$HOME/bin:/usr/local/bin:$PATH # Path to your oh-my-zsh installation. -export ZSH="/home/ardent/.oh-my-zsh" +export ZSH="/home/tim/.oh-my-zsh" # Set name of the theme to load --- if set to "random", it will # load a random theme each time oh-my-zsh is loaded, in which case,