From a6cc6a28891eae384a3c25eb1c4f335ef5e75cf8 Mon Sep 17 00:00:00 2001 From: Bartek Stalewski Date: Tue, 21 Jan 2020 17:23:56 +0100 Subject: [PATCH] Colors. --- zsh/p10k.zsh | 51 ++++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/zsh/p10k.zsh b/zsh/p10k.zsh index 8881e80..171a1b3 100644 --- a/zsh/p10k.zsh +++ b/zsh/p10k.zsh @@ -39,9 +39,11 @@ virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html) aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) kubecontext # current kubernetes context (https://kubernetes.io/) + terraform # terraform workspace (https://www.terraform.io) dir # current directory vcs # git status command_execution_time # duration of the last command + background_jobs # presence of background jobs status # exit code of the last command # =========================[ Line #2 ]========================= newline @@ -54,7 +56,6 @@ # last prompt line gets hidden if it would overlap with left prompt. typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( # =========================[ Line #1 ]========================= - # background_jobs # presence of background jobs # direnv # direnv status (https://direnv.net/) # anaconda # conda environment (https://conda.io/) # pyenv # python environment (https://github.com/pyenv/pyenv) @@ -72,7 +73,6 @@ # 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) - # terraform # terraform workspace (https://www.terraform.io) # 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/) @@ -231,7 +231,7 @@ ##################################[ dir: current directory ]################################## # Default current directory color. - typeset -g POWERLEVEL9K_DIR_FOREGROUND=31 + typeset -g POWERLEVEL9K_DIR_FOREGROUND=37 # If directory is too long, shorten some of its segments to the shortest possible unique # prefix. The shortened directory can be tab-completed to the original. typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique @@ -241,9 +241,9 @@ typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=103 # Color of the anchor directory segments. Anchor segments are never shortened. The first # segment is always an anchor. - typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=39 + typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=37 # Display anchor directory segments in bold. - typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=true + typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=false # Don't shorten directories that contain any of these files. They are anchors. local anchor_files=( .bzr @@ -270,7 +270,7 @@ # directory will be shortened only when prompt doesn't fit or when other parameters demand it # (see POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS and POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT below). # If set to `0`, directory will always be shortened to its minimum length. - typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=80 + typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=0 # When `dir` segment is on the last prompt line, try to shorten it enough to leave at least this # many columns for typing commands. typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40 @@ -330,7 +330,7 @@ #####################################[ vcs: git status ]###################################### # Branch icon. Set this parameter to '\uF126 ' for the popular Powerline branch icon. - typeset -g POWERLEVEL9K_VCS_BRANCH_ICON= + typeset -g POWERLEVEL9K_VCS_BRANCH_ICON='\uF126 ' POWERLEVEL9K_VCS_BRANCH_ICON=${(g::)POWERLEVEL9K_VCS_BRANCH_ICON} # Untracked files icon. It's really a question mark, your font isn't broken. @@ -338,6 +338,9 @@ typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?' POWERLEVEL9K_VCS_UNTRACKED_ICON=${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON} + typeset -g POWERLEVEL9K_VCS_STASHED_ICON='≡' + POWERLEVEL9K_VCS_STASHED_ICON=${(g::)POWERLEVEL9K_VCS_STASHED_ICON} + # Formatter for Git status. # # Example output: master ⇣42⇡42 *42 merge ~42 +42 !42 ?42. @@ -358,11 +361,13 @@ if (( $1 )); then # Styling for up-to-date Git status. - local meta='%f' # default foreground - local clean='%76F' # green foreground - local modified='%178F' # yellow foreground - local untracked='%39F' # blue foreground - local conflicted='%196F' # red foreground + local meta='%f' + local clean='%f' + local staged='%2F' + local stashed='%3F' + local modified='%1F' + local untracked='%1F' + local conflicted='%196F' else # Styling for incomplete and stale Git status. local meta='%244F' # grey foreground @@ -400,21 +405,21 @@ (( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}⇣${VCS_STATUS_COMMITS_BEHIND}" # ⇡42 if ahead of the remote; no leading space if also behind the remote: ⇣42⇡42. (( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && res+=" " - (( VCS_STATUS_COMMITS_AHEAD )) && res+="${clean}⇡${VCS_STATUS_COMMITS_AHEAD}" + (( VCS_STATUS_COMMITS_AHEAD )) && res+="${clean}${VCS_STATUS_COMMITS_AHEAD}${staged}⇡${clean}" # *42 if have stashes. - (( VCS_STATUS_STASHES )) && res+=" ${clean}*${VCS_STATUS_STASHES}" + (( VCS_STATUS_STASHES )) && res+=" ${clean}${VCS_STATUS_STASHES}${stashed}${POWERLEVEL9K_VCS_STASHED_ICON}${clean}" # 'merge' if the repo is in an unusual state. - [[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}" + [[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}${clean}" # ~42 if have merge conflicts. - (( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}~${VCS_STATUS_NUM_CONFLICTED}" + (( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}~${VCS_STATUS_NUM_CONFLICTED}${clean}" # +42 if have staged changes. - (( VCS_STATUS_NUM_STAGED )) && res+=" ${modified}+${VCS_STATUS_NUM_STAGED}" + (( VCS_STATUS_NUM_STAGED )) && res+=" ${clean}${VCS_STATUS_NUM_STAGED}${staged}M${clean}" # !42 if have unstaged changes. - (( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified}!${VCS_STATUS_NUM_UNSTAGED}" + (( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${clean}${VCS_STATUS_NUM_UNSTAGED}${untracked}M${clean}" # ?42 if have untracked files. It's really a question mark, your font isn't broken. # See POWERLEVEL9K_VCS_UNTRACKED_ICON above if you want to use a different icon. # Remove the next line if you don't want to see untracked files at all. - (( VCS_STATUS_NUM_UNTRACKED )) && res+=" ${untracked}${POWERLEVEL9K_VCS_UNTRACKED_ICON}${VCS_STATUS_NUM_UNTRACKED}" + (( VCS_STATUS_NUM_UNTRACKED )) && res+=" ${VCS_STATUS_NUM_UNTRACKED}${untracked}${POWERLEVEL9K_VCS_UNTRACKED_ICON}${clean}" typeset -g my_git_format=$res } @@ -485,11 +490,11 @@ ###################[ command_execution_time: duration of the last command ]################### # Show duration of the last command if takes longer than this many seconds. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3 + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=2 # Show this many fractional digits. Zero means round to seconds. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 # Execution time color. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=101 + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=208 # Duration format: 1d 2h 3m 4s. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s' # Custom icon. @@ -612,7 +617,7 @@ ###[ virtualenv: python virtual environment (https://docs.python.org/3/library/venv.html) ]### # Python virtual environment color. - typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=37 + typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=15 # Don't show Python version next to the virtual environment name. typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false # Separate environment name from Python version only with a space. @@ -796,7 +801,7 @@ # '*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=134 + 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