Add dir to sentient line, fix git branch length

This commit is contained in:
Tim 2021-03-19 15:30:19 +01:00
parent 8ae6c031f9
commit ac6adbd425
2 changed files with 28 additions and 21 deletions

View File

@ -43,6 +43,7 @@
# =========================[ Line #2 ]========================= # =========================[ Line #2 ]=========================
newline newline
time time
dir
prompt_char # prompt symbol prompt_char # prompt symbol
) )
@ -57,7 +58,7 @@
background_jobs # presence of background jobs background_jobs # presence of background jobs
direnv # direnv status (https://direnv.net/) direnv # direnv status (https://direnv.net/)
virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html) 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) pyenv # python environment (https://github.com/pyenv/pyenv)
goenv # go environment (https://github.com/syndbg/goenv) goenv # go environment (https://github.com/syndbg/goenv)
nodenv # node.js version from nodenv (https://github.com/nodenv/nodenv) nodenv # node.js version from nodenv (https://github.com/nodenv/nodenv)
@ -67,31 +68,32 @@
# go_version # go version (https://golang.org) # go_version # go version (https://golang.org)
# rust_version # rustc version (https://www.rust-lang.org) # rust_version # rustc version (https://www.rust-lang.org)
# dotnet_version # .NET version (https://dotnet.microsoft.com) # dotnet_version # .NET version (https://dotnet.microsoft.com)
rbenv # ruby version from rbenv (https://github.com/rbenv/rbenv) # rbenv # ruby version from rbenv (https://github.com/rbenv/rbenv)
rvm # ruby version from rvm (https://rvm.io) # rvm # ruby version from rvm (https://rvm.io)
fvm # flutter version management (https://github.com/leoafarias/fvm) # fvm # flutter version management (https://github.com/leoafarias/fvm)
luaenv # lua version from luaenv (https://github.com/cehoffman/luaenv) # luaenv # lua version from luaenv (https://github.com/cehoffman/luaenv)
jenv # java version from jenv (https://github.com/jenv/jenv) # jenv # java version from jenv (https://github.com/jenv/jenv)
plenv # perl version from plenv (https://github.com/tokuhirom/plenv) # plenv # perl version from plenv (https://github.com/tokuhirom/plenv)
kubecontext # current kubernetes context (https://kubernetes.io/) kubecontext # current kubernetes context (https://kubernetes.io/)
terraform # terraform workspace (https://www.terraform.io) terraform # terraform workspace (https://www.terraform.io)
aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) # 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/) # aws_eb_env # aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/)
azure # azure account name (https://docs.microsoft.com/en-us/cli/azure) # azure # azure account name (https://docs.microsoft.com/en-us/cli/azure)
gcloud # google cloud cli acccount and project (https://cloud.google.com/) gcloud # google cloud cli acccount and project (https://cloud.google.com/)
google_app_cred # google application credentials (https://cloud.google.com/docs/authentication/production) google_app_cred # google application credentials (https://cloud.google.com/docs/authentication/production)
context # user@hostname context # user@hostname
nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) # nordvpn # nordvpn connection status, linux only (https://nordvpn.com/)
ranger # ranger shell (https://github.com/ranger/ranger) # ranger # ranger shell (https://github.com/ranger/ranger)
nnn # nnn shell (https://github.com/jarun/nnn) # nnn # nnn shell (https://github.com/jarun/nnn)
vim_shell # vim shell indicator (:sh) vim_shell # vim shell indicator (:sh)
midnight_commander # midnight commander shell (https://midnight-commander.org/) midnight_commander # midnight commander shell (https://midnight-commander.org/)
vi_mode # vi mode (you don't need this if you've enabled prompt_char) vi_mode # vi mode (you don't need this if you've enabled prompt_char)
# vpn_ip # virtual private network indicator # vpn_ip # virtual private network indicator
# ram # free RAM ram # free RAM
# load # CPU load load # CPU load
todo # todo items (https://github.com/todotxt/todo.txt-cli) todo # todo items (https://github.com/todotxt/todo.txt-cli)
time # current time time # current time
battery
# =========================[ Line #2 ]========================= # =========================[ Line #2 ]=========================
newline newline
# public_ip # public IP address # public_ip # public IP address
@ -299,6 +301,7 @@
# Show this icon when the current directory is not writable. POWERLEVEL9K_DIR_SHOW_WRITABLE # 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. # 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='⭐'
typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='✖️'
# Custom prefix. # Custom prefix.
# typeset -g POWERLEVEL9K_DIR_PREFIX='%250Fin ' # 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. # If local branch name or tag is at most 32 characters long, show it in full.
# Otherwise show the first 12 … the last 12. # Otherwise show the first 12 … the last 12.
(( $#where > 32 )) && where[13,-13]="…" (( $#where > 80 )) && where[12,-64]="…"
res+="${clean}${where//\%/%%}" # escape % res+="${clean}${where//\%/%%}" # escape %
# Display the current Git commit if there is no branch or tag. # Display the current Git commit if there is no branch or tag.
@ -1090,9 +1093,13 @@
prompt_example prompt_example
} }
function p10k-on-pre-prompt() { p10k display '1|2/right'=show '2/left/time'=hide } # CUSTOM this replaces the transient prompt function
# see https://www.reddit.com/r/zsh/comments/dsh1g3/new_powerlevel10k_feature_transient_prompt/f6w9ept/
function p10k-on-post-prompt() { p10k display '1|2/right'=hide '2/left/time'=show } # 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. # User-defined prompt segments can be customized the same way as built-in segments.
# typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=208 # typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=208
@ -1117,7 +1124,7 @@
# - verbose: Enable instant prompt and print a warning when detecting console output during # - 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 # 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. # 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. # 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 # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload

View File

@ -9,7 +9,7 @@ fi
# export PATH=$HOME/bin:/usr/local/bin:$PATH # export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation. # 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 # 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, # load a random theme each time oh-my-zsh is loaded, in which case,