typeset -g GITSTATUS_AUTO_INSTALL=0 typeset -g GITSTATUS_DAEMON=/usr/libexec/gitstatusd source "/usr/share/zsh/plugins/gitstatus/gitstatus.prompt.zsh" source "$EXTERN_PLUGINS/powerlevel10k/powerlevel10k.zsh-theme" # Prompt elements typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( os_icon time load ram disk_usage battery newline context vi_mode dir ) typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( c_new_mail c_weather c_covid_19 c_mpv newline c_todo background_jobs status command_execution_time vcs vim_shell root_indicator ssh ) # General settings typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always typeset -g POWERLEVEL9K_MODE=nerdfont-complete typeset -g POWERLEVEL9K_ICON_PADDING=none typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true typeset -g POWERLEVEL9K_USE_CACHE=true # Colors typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=0 typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND=3 typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=3 typeset -g POWERLEVEL9K_CONTEXT_BACKGROUND=0 typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1 typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=255 typeset -g POWERLEVEL9K_DIR_FOREGROUND=254 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_VI_MODE_FOREGROUND=0 typeset -g POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND=2 typeset -g POWERLEVEL9K_VI_MODE_VISUAL_BACKGROUND=3 typeset -g POWERLEVEL9K_VI_MODE_OVERWRITE_BACKGROUND=1 typeset -g POWERLEVEL9K_VI_MODE_INSERT_BACKGROUND=4 typeset -g POWERLEVEL9K_VCS_{CLEAN,UNTRACKED}_BACKGROUND=2 typeset -g POWERLEVEL9K_VCS_{MODIFIED,CONFLICTED}_BACKGROUND=3 typeset -g POWERLEVEL9K_VCS_LOADING_BACKGROUND=8 # Segment settings ## Command time typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3 typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s' ## Context (user@host) typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%n@%m' typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_TEMPLATE='%n@%m' typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%n@%m' ## Directory local anchor_files=( .git APKBUILD PKGBUILD Dockerfile main.yml ) typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique typeset -g POWERLEVEL9K_SHORTEN_FOLDER_MARKER="(${(j:|:)anchor_files})" typeset -g POWERLEVEL9K_SHORTEN_DELIMITER= typeset -g POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=true typeset -g POWERLEVEL9K_DIR_MAX_LENGTH='50%' typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=true ## Disk usage typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=90 typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=95 ## Prompt character typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯' ## Separators typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR='\uE0BD' typeset -g POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR='\uE0BC' typeset -g POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR='\uE0BA' typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0B0' typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0B2' typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL= typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL= typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL= ## Status typeset -g POWERLEVEL9K_STATUS_OK{,_PIPE}=false typeset -g POWERLEVEL9K_STATUS_ERROR{,_{SIGNAL,PIPE}}=true typeset -g POWERLEVEL9K_STATUS_VERBOSE{,_SIGNAME}=true typeset -g POWERLEVEL9K_STATUS_ERROR_{VISUAL,SIGNAL,PIPE}_IDENTIFIER_EXPANSION='' ## Current time typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false ## Vi mode typeset -g POWERLEVEL9K_VI_COMMAND_MODE_STRING=N typeset -g POWERLEVEL9K_VI_VISUAL_MODE_STRING=V typeset -g POWERLEVEL9K_VI_OVERWRITE_MODE_STRING=O typeset -g POWERLEVEL9K_VI_INSERT_MODE_STRING=I ## VCS typeset -g POWERLEVEL9K_VCS_BRANCH_ICON='\uF126 ' typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?' function my_git_formatter() { # Formatter for Git status. # VCS_STATUS_* parameters are set by gitstatus plugin. See reference: # https://github.com/romkatv/gitstatus/blob/master/gitstatus.plugin.zsh. emulate -L zsh if [[ -n $P9K_CONTENT ]]; then typeset -g my_git_format=$P9K_CONTENT return fi # Styling for different parts of Git status. local meta='%7F' # white foreground local clean='%0F' # black foreground local modified='%0F' # black foreground local untracked='%0F' # black foreground local conflicted='%1F' # red foreground local res if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then local branch=${(V)VCS_STATUS_LOCAL_BRANCH} # If local branch name is at most 32 characters long, show it in full. # Otherwise show the first 12 … the last 12. # Tip: To always show local branch name in full without truncation, delete the next line. (( $#branch > 32 )) && branch[13,-13]="…" # <-- this line res+="${clean}${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}${branch//\%/%%}" fi if [[ -n $VCS_STATUS_TAG # Show tag only if not on a branch. # Tip: To always show tag, delete the next line. && -z $VCS_STATUS_LOCAL_BRANCH # <-- this line ]]; then local tag=${(V)VCS_STATUS_TAG} # If tag name is at most 32 characters long, show it in full. # Otherwise show the first 12 … the last 12. # Tip: To always show tag name in full without truncation, delete the next line. (( $#tag > 32 )) && tag[13,-13]="…" # <-- this line res+="${meta}#${clean}${tag//\%/%%}" fi # Display the current Git commit if there is no branch and no tag. # Tip: To always display the current Git commit, delete the next line. [[ -z $VCS_STATUS_LOCAL_BRANCH && -z $VCS_STATUS_TAG ]] && # <-- this line res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}" # Show tracking branch name if it differs from local branch. if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" fi # Display "wip" if the latest commit's summary contains "wip" or "WIP". if [[ $VCS_STATUS_COMMIT_SUMMARY == (|*[^[:alnum:]])(wip|WIP)(|[^[:alnum:]]*) ]]; then res+=" ${modified}wip" fi # ⇣42 if behind the remote. (( 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}" # ⇠42 if behind the push remote. (( VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" ${clean}⇠${VCS_STATUS_PUSH_COMMITS_BEHIND}" (( VCS_STATUS_PUSH_COMMITS_AHEAD && !VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" " # ⇢42 if ahead of the push remote; no leading space if also behind: ⇠42⇢42. (( VCS_STATUS_PUSH_COMMITS_AHEAD )) && res+="${clean}⇢${VCS_STATUS_PUSH_COMMITS_AHEAD}" # *42 if have stashes. (( VCS_STATUS_STASHES )) && res+=" ${clean}*${VCS_STATUS_STASHES}" # 'merge' if the repo is in an unusual state. [[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}" # ~42 if have merge conflicts. (( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}~${VCS_STATUS_NUM_CONFLICTED}" # +42 if have staged changes. (( VCS_STATUS_NUM_STAGED )) && res+=" ${modified}+${VCS_STATUS_NUM_STAGED}" # !42 if have unstaged changes. (( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified}!${VCS_STATUS_NUM_UNSTAGED}" # ?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}${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON}${VCS_STATUS_NUM_UNTRACKED}" # "─" if the number of unstaged files is unknown. This can happen due to # POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY (see below) being set to a non-negative number lower # than the number of files in the Git index, or due to bash.showDirtyState being set to false # in the repository config. The number of staged and untracked files may also be unknown # in this case. (( VCS_STATUS_HAS_UNSTAGED == -1 )) && res+=" ${modified}─" typeset -g my_git_format=$res } functions -M my_git_formatter 2>/dev/null typeset -g POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY=-1 typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter()))+${my_git_format}}' typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,CONFLICTED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1 typeset -g POWERLEVEL9K_VCS_BACKENDS=(git) # Load custom prompt segments from here P10K_CUSTOM_PROMPTS_PATH="$ZDOTDIR/p10k-segments/" fpath+=("$P10K_CUSTOM_PROMPTS_PATH") P10K_CUSTOM_PROMPTS=("$P10K_CUSTOM_PROMPTS_PATH"/*) autoload -Uz ${P10K_CUSTOM_PROMPTS##*${P10K_CUSTOM_PROMPTS##/}/}