319 lines
15 KiB
Bash
319 lines
15 KiB
Bash
'builtin' 'local' '-a' 'p10k_config_opts'
|
||
[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases')
|
||
[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob')
|
||
[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand')
|
||
'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
|
||
|
||
() {
|
||
emulate -L zsh -o extended_glob
|
||
|
||
unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR'
|
||
autoload -Uz is-at-least && is-at-least 5.1 || return
|
||
|
||
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
|
||
# line 1
|
||
virtualenv
|
||
# aws
|
||
# terraform
|
||
kubecontext
|
||
vcs
|
||
background_jobs
|
||
command_execution_time
|
||
status
|
||
newline
|
||
# line 2
|
||
vi_mode
|
||
context
|
||
dir
|
||
prompt_char
|
||
)
|
||
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
|
||
|
||
typeset -g POWERLEVEL9K_MODE=nerdfont-complete
|
||
typeset -g POWERLEVEL9K_ICON_PADDING=none
|
||
typeset -g POWERLEVEL9K_BACKGROUND=
|
||
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE=
|
||
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' '
|
||
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR=
|
||
typeset -g POWERLEVEL9K_ICON_BEFORE_CONTENT=true
|
||
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=false
|
||
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=
|
||
typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX=
|
||
typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX=
|
||
typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL=
|
||
typeset -g POWERLEVEL9K_SHOW_RULER=false
|
||
typeset -g POWERLEVEL9K_RULER_CHAR='─'
|
||
typeset -g POWERLEVEL9K_RULER_FOREGROUND=240
|
||
|
||
# prompt symbol
|
||
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=76
|
||
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=196
|
||
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯'
|
||
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❯'
|
||
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='❯'
|
||
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION='❯'
|
||
typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true
|
||
typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=''
|
||
typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL=
|
||
|
||
# working directory
|
||
typeset -g POWERLEVEL9K_DIR_FOREGROUND=37
|
||
typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique
|
||
typeset -g POWERLEVEL9K_SHORTEN_DELIMITER=
|
||
typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=37
|
||
typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=37
|
||
typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=false
|
||
local anchor_files=(
|
||
.git
|
||
)
|
||
typeset -g POWERLEVEL9K_SHORTEN_FOLDER_MARKER="(${(j:|:)anchor_files})"
|
||
typeset -g POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=false
|
||
typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
|
||
typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=80
|
||
typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40
|
||
typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT=50
|
||
typeset -g POWERLEVEL9K_DIR_HYPERLINK=false
|
||
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v2
|
||
typeset -g POWERLEVEL9K_DIR_CLASSES=()
|
||
|
||
# vcs
|
||
typeset -g POWERLEVEL9K_VCS_FOREGROUND=246
|
||
typeset -g POWERLEVEL9K_VCS_LOADING_FOREGROUND=240
|
||
typeset -g POWERLEVEL9K_VCS_LOADING_TEXT=
|
||
typeset -g POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0
|
||
typeset -g POWERLEVEL9K_VCS_{INCOMING,OUTGOING}_CHANGESFORMAT_FOREGROUND=
|
||
typeset -g POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind git-stash)
|
||
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=''
|
||
typeset -g POWERLEVEL9K_VCS_COMMIT_ICON='@'
|
||
typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED}_ICON=
|
||
typeset -g POWERLEVEL9K_VCS_DIRTY_ICON='*'
|
||
typeset -g POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON=':⇣'
|
||
typeset -g POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON=':⇡'
|
||
typeset -g POWERLEVEL9K_VCS_{COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=1
|
||
typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${${${P9K_CONTENT/⇣* :⇡/⇣⇡}// }//:/ }'
|
||
typeset -g POWERLEVEL9K_VCS_STASH_ICON='≡'
|
||
typeset -g POWERLEVEL9K_VCS_GIT_ICON='\uF126'
|
||
typeset -g POWERLEVEL9K_VCS_GIT_GITHUB_ICON='\uF126'
|
||
typeset -g POWERLEVEL9K_VCS_GIT_GITLAB_ICON='\uF126'
|
||
typeset -g POWERLEVEL9K_VCS_GIT_BITBUCKET_ICON='\uF126'
|
||
|
||
# status (of the last command)
|
||
typeset -g POWERLEVEL9K_STATUS_EXTENDED_STATES=true
|
||
typeset -g POWERLEVEL9K_STATUS_OK=false
|
||
typeset -g POWERLEVEL9K_STATUS_OK_FOREGROUND=70
|
||
typeset -g POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION='✔'
|
||
typeset -g POWERLEVEL9K_STATUS_OK_PIPE=true
|
||
typeset -g POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=70
|
||
typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION='✔'
|
||
typeset -g POWERLEVEL9K_STATUS_ERROR=false
|
||
typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=160
|
||
typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION='✘'
|
||
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL=true
|
||
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=160
|
||
typeset -g POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false
|
||
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION='✘'
|
||
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE=true
|
||
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=160
|
||
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION='✘'
|
||
|
||
# command_execution_time
|
||
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3
|
||
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
|
||
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=220
|
||
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
|
||
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION=''
|
||
|
||
# background_jobs
|
||
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false
|
||
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=70
|
||
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='⇶'
|
||
|
||
# context (username/hostname)
|
||
typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1
|
||
typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_FOREGROUND=
|
||
typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=
|
||
typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%B%n@%m'
|
||
typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_TEMPLATE='%n@%m'
|
||
typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%n@%m'
|
||
typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION=
|
||
|
||
# virtualenv
|
||
# Python virtual environment color.
|
||
typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=15
|
||
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
|
||
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV=false
|
||
typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER=
|
||
|
||
#############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]#############
|
||
# Show kubecontext only when the the command you are typing invokes one of these tools.
|
||
# Tip: Remove the next line to always show kubecontext.
|
||
#typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile'
|
||
|
||
# Kubernetes context classes for the purpose of using different colors, icons and expansions with
|
||
# different contexts.
|
||
#
|
||
# POWERLEVEL9K_KUBECONTEXT_CLASSES is an array with even number of elements. The first element
|
||
# in each pair defines a pattern against which the current kubernetes context gets matched.
|
||
# More specifically, it's P9K_CONTENT prior to the application of context expansion (see below)
|
||
# that gets matched. If you unset all POWERLEVEL9K_KUBECONTEXT_*CONTENT_EXPANSION parameters,
|
||
# you'll see this value in your prompt. The second element of each pair in
|
||
# POWERLEVEL9K_KUBECONTEXT_CLASSES defines the context class. Patterns are tried in order. The
|
||
# first match wins.
|
||
#
|
||
# For example, given these settings:
|
||
#
|
||
# typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=(
|
||
# '*prod*' PROD
|
||
# '*test*' TEST
|
||
# '*' DEFAULT)
|
||
#
|
||
# If your current kubernetes context is "deathray-testing/default", its class is TEST
|
||
# because "deathray-testing/default" doesn't match the pattern '*prod*' but does match '*test*'.
|
||
#
|
||
# You can define different colors, icons and content expansions for different classes:
|
||
#
|
||
# typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_FOREGROUND=28
|
||
# typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||
# typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <'
|
||
typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=(
|
||
# '*prod*' PROD # These values are examples that are unlikely
|
||
# '*test*' TEST # to match your needs. Customize them as needed.
|
||
'*' DEFAULT)
|
||
typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=38
|
||
# typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||
|
||
# Use POWERLEVEL9K_KUBECONTEXT_CONTENT_EXPANSION to specify the content displayed by kubecontext
|
||
# segment. Parameter expansions are very flexible and fast, too. See reference:
|
||
# http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion.
|
||
#
|
||
# Within the expansion the following parameters are always available:
|
||
#
|
||
# - P9K_CONTENT The content that would've been displayed if there was no content
|
||
# expansion defined.
|
||
# - P9K_KUBECONTEXT_NAME The current context's name. Corresponds to column NAME in the
|
||
# output of `kubectl config get-contexts`.
|
||
# - P9K_KUBECONTEXT_CLUSTER The current context's cluster. Corresponds to column CLUSTER in the
|
||
# output of `kubectl config get-contexts`.
|
||
# - P9K_KUBECONTEXT_NAMESPACE The current context's namespace. Corresponds to column NAMESPACE
|
||
# in the output of `kubectl config get-contexts`. If there is no
|
||
# namespace, the parameter is set to "default".
|
||
# - P9K_KUBECONTEXT_USER The current context's user. Corresponds to column AUTHINFO in the
|
||
# output of `kubectl config get-contexts`.
|
||
#
|
||
# If the context points to Google Kubernetes Engine (GKE) or Elastic Kubernetes Service (EKS),
|
||
# the following extra parameters are available:
|
||
#
|
||
# - P9K_KUBECONTEXT_CLOUD_NAME Either "gke" or "eks".
|
||
# - P9K_KUBECONTEXT_CLOUD_ACCOUNT Account/project ID.
|
||
# - P9K_KUBECONTEXT_CLOUD_ZONE Availability zone.
|
||
# - P9K_KUBECONTEXT_CLOUD_CLUSTER Cluster.
|
||
#
|
||
# P9K_KUBECONTEXT_CLOUD_* parameters are derived from P9K_KUBECONTEXT_CLUSTER. For example,
|
||
# if P9K_KUBECONTEXT_CLUSTER is "gke_my-account_us-east1-a_my-cluster-01":
|
||
#
|
||
# - P9K_KUBECONTEXT_CLOUD_NAME=gke
|
||
# - P9K_KUBECONTEXT_CLOUD_ACCOUNT=my-account
|
||
# - P9K_KUBECONTEXT_CLOUD_ZONE=us-east1-a
|
||
# - P9K_KUBECONTEXT_CLOUD_CLUSTER=my-cluster-01
|
||
#
|
||
# If P9K_KUBECONTEXT_CLUSTER is "arn:aws:eks:us-east-1:123456789012:cluster/my-cluster-01":
|
||
#
|
||
# - P9K_KUBECONTEXT_CLOUD_NAME=eks
|
||
# - P9K_KUBECONTEXT_CLOUD_ACCOUNT=123456789012
|
||
# - P9K_KUBECONTEXT_CLOUD_ZONE=us-east-1
|
||
# - P9K_KUBECONTEXT_CLOUD_CLUSTER=my-cluster-01
|
||
typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION=
|
||
# Show P9K_KUBECONTEXT_CLOUD_CLUSTER if it's not empty and fall back to P9K_KUBECONTEXT_NAME.
|
||
POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION+='${P9K_KUBECONTEXT_CLOUD_CLUSTER:-${P9K_KUBECONTEXT_NAME}}'
|
||
# Append the current context's namespace if it's not "default".
|
||
POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION+='${${:-/$P9K_KUBECONTEXT_NAMESPACE}:#/default}'
|
||
|
||
# Custom prefix.
|
||
# typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='%fat '
|
||
|
||
################[ terraform: terraform workspace (https://www.terraform.io) ]#################
|
||
# Don't show terraform workspace if it's literally "default".
|
||
typeset -g POWERLEVEL9K_TERRAFORM_SHOW_DEFAULT=false
|
||
# POWERLEVEL9K_TERRAFORM_CLASSES is an array with even number of elements. The first element
|
||
# in each pair defines a pattern against which the current terraform workspace gets matched.
|
||
# More specifically, it's P9K_CONTENT prior to the application of context expansion (see below)
|
||
# that gets matched. If you unset all POWERLEVEL9K_TERRAFORM_*CONTENT_EXPANSION parameters,
|
||
# you'll see this value in your prompt. The second element of each pair in
|
||
# POWERLEVEL9K_TERRAFORM_CLASSES defines the workspace class. Patterns are tried in order. The
|
||
# first match wins.
|
||
#
|
||
# For example, given these settings:
|
||
#
|
||
# typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=(
|
||
# '*prod*' PROD
|
||
# '*test*' TEST
|
||
# '*' DEFAULT)
|
||
#
|
||
# If your current terraform workspace is "project_test", its class is TEST because "project_test"
|
||
# doesn't match the pattern '*prod*' but does match '*test*'.
|
||
#
|
||
# You can define different colors, icons and content expansions for different classes:
|
||
#
|
||
# typeset -g POWERLEVEL9K_TERRAFORM_TEST_FOREGROUND=28
|
||
# typeset -g POWERLEVEL9K_TERRAFORM_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||
# typeset -g POWERLEVEL9K_TERRAFORM_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <'
|
||
typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=(
|
||
# '*prod*' PROD # These values are examples that are unlikely
|
||
# '*test*' TEST # to match your needs. Customize them as needed.
|
||
'*' DEFAULT)
|
||
typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_FOREGROUND=38
|
||
# typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||
|
||
#[ aws: aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) ]#
|
||
# Show aws only when the the command you are typing invokes one of these tools.
|
||
# Tip: Remove the next line to always show aws.
|
||
#typeset -g POWERLEVEL9K_AWS_SHOW_ON_COMMAND='aws|terraform|aws-mfa'
|
||
|
||
# POWERLEVEL9K_AWS_CLASSES is an array with even number of elements. The first element
|
||
# in each pair defines a pattern against which the current AWS profile gets matched.
|
||
# More specifically, it's P9K_CONTENT prior to the application of context expansion (see below)
|
||
# that gets matched. If you unset all POWERLEVEL9K_AWS_*CONTENT_EXPANSION parameters,
|
||
# you'll see this value in your prompt. The second element of each pair in
|
||
# POWERLEVEL9K_AWS_CLASSES defines the context class. Patterns are tried in order. The
|
||
# first match wins.
|
||
#
|
||
# For example, given these settings:
|
||
#
|
||
# typeset -g POWERLEVEL9K_AWS_CLASSES=(
|
||
# '*prod*' PROD
|
||
# '*test*' TEST
|
||
# '*' DEFAULT)
|
||
#
|
||
# If your current AWS profile is "company_test", its class is TEST
|
||
# because "company_test" doesn't match the pattern '*prod*' but does match '*test*'.
|
||
#
|
||
# You can define different colors, icons and content expansions for different classes:
|
||
#
|
||
# typeset -g POWERLEVEL9K_AWS_TEST_FOREGROUND=28
|
||
# typeset -g POWERLEVEL9K_AWS_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||
# typeset -g POWERLEVEL9K_AWS_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <'
|
||
typeset -g POWERLEVEL9K_AWS_CLASSES=(
|
||
# '*prod*' PROD # These values are examples that are unlikely
|
||
# '*test*' TEST # to match your needs. Customize them as needed.
|
||
'*' DEFAULT)
|
||
typeset -g POWERLEVEL9K_AWS_DEFAULT_FOREGROUND=208
|
||
# typeset -g POWERLEVEL9K_AWS_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||
|
||
# vi_mode
|
||
typeset -g POWERLEVEL9K_VI_INSERT_MODE_STRING=
|
||
typeset -g POWERLEVEL9K_VI_COMMAND_MODE_STRING='VI MODE '
|
||
typeset -g POWERLEVEL9K_VI_MODE_NORMAL_FOREGROUND=15
|
||
typeset -g POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND=1
|
||
|
||
# other settings
|
||
typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=off
|
||
typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose
|
||
typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
|
||
(( ! $+functions[p10k] )) || p10k reload
|
||
}
|
||
|
||
typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a}
|
||
|
||
(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
|
||
'builtin' 'unset' 'p10k_config_opts'
|