powerlevel10k/config/p10k-pure.zsh

125 lines
6.3 KiB
Bash
Raw Normal View History

2019-07-20 12:46:18 +00:00
# Config file for Powerlevel10k with the style of Pure (https://github.com/sindresorhus/pure).
#
# Differences from Pure:
#
# - Git:
# - `@c4d3ec2c` instead of something like `v1.4.0~11` when in detached HEAD state.
# - No automatic `git fetch` (the same as in Pure with `PURE_GIT_PULL=0`).
#
2019-10-10 07:58:14 +00:00
# Apart from the differences listed above, the replication of Pure prompt is exact. This includes
# even the bad parts. For example, just like in Pure, prompt provides no indication of Git status
# being stale; prompt symbol is the same in command, visual and overwrite vi modes; when prompt
# doesn't fit on one line, it wraps around with no attempt to shorten anything. This behavior is
# likely to make user experience worse than with any other Powerlevel10k config. If you like the
# general style of Pure but not particularly attached to all its quirks, type `p10k configure`
# while having Powerlevel10k theme active and pick lean style.
2019-07-20 12:46:18 +00:00
2019-09-23 17:32:39 +00:00
# Temporarily change options.
'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'
2019-07-20 12:46:18 +00:00
() {
emulate -L zsh
setopt no_unset
2019-10-10 07:58:14 +00:00
# Unset all configuration options.
unset -m 'POWERLEVEL9K_*'
2019-07-20 12:46:18 +00:00
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
dir # current directory
vcs # git status
context # user@host
command_execution_time # previous command duration
newline # \n
virtualenv # python virtual environment
prompt_char # prompt symbol
)
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
2019-10-10 07:58:14 +00:00
# Basic style options that define the overall prompt look.
2019-07-20 12:46:18 +00:00
typeset -g POWERLEVEL9K_BACKGROUND= # transparent background
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol
typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION= # disable segment icons
2019-10-10 07:58:14 +00:00
# Add an empty line before each prompt except the first. This doesn't emulate the bug
# in Pure that makes prompt drift down whenever you use the ALT-C binding from fzf or similar.
2019-07-20 12:46:18 +00:00
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
# Magenta prompt symbol if the last command succeeded.
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=magenta
# Red prompt symbol if the last command failed.
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=red
# Default prompt symbol.
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION=''
# Prompt symbol in command vi mode.
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION=''
# Prompt symbol in visual vi mode is the same as in command mode. This is unlikely
# to be desired by anyone but that's how Pure does it.
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION=''
2019-10-10 07:58:14 +00:00
# Prompt symbol in overwrite vi mode is the same as in command mode. This is unlikely
# to be desired by anyone but that's how Pure does it.
typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=false
2019-07-20 12:46:18 +00:00
# Grey Python Virtual Environment.
typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=242
2019-10-10 07:58:14 +00:00
# Don't show Python version.
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER=
2019-07-20 12:46:18 +00:00
# Blue current directory.
typeset -g POWERLEVEL9K_DIR_FOREGROUND=blue
2019-10-10 07:58:14 +00:00
# Grey Git prompt. This makes stale prompts indistinguishable from up-to-date ones. This is
# unlikely to be desired by anyone but that's how Pure does it.
2019-07-20 12:46:18 +00:00
typeset -g POWERLEVEL9K_VCS_FOREGROUND=242
2019-10-10 07:58:14 +00:00
# Disable async loading indicator to make directories that aren't git repositories
# indistinguishable from large git repositories without known state. This is unlikely
2019-07-20 12:46:18 +00:00
# to be desired by anyone but that's how Pure does it.
2019-10-10 07:58:14 +00:00
typeset -g POWERLEVEL9K_VCS_LOADING_TEXT=
# Cyan ahead/behind arrows.
typeset -g POWERLEVEL9K_VCS_{INCOMING,OUTGOING}_CHANGESFORMAT_FOREGROUND=cyan
# Don't show remote branch, current tag or stashes.
typeset -g POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind)
# Don't show the branh icon.
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=
# When in detached HEAD state, show @commit where branch normally goes.
typeset -g POWERLEVEL9K_VCS_COMMIT_ICON='@'
# Don't show staged, unstaged, untracked indicators.
typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED}_ICON=$'\b'
# Show '*' when there are staged, unstaged or untracked files.
typeset -g POWERLEVEL9K_VCS_DIRTY_ICON='*'
# Show '⇣' if local branch is behind remote.
typeset -g POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON='⇣'
# Show '⇡' if local branch is ahead of remote.
typeset -g POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON='⇡'
# Don't show the number of commits next to the ahead/behind arrows.
typeset -g POWERLEVEL9K_VCS_{COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=1
# Remove space between '⇣' and '⇡', and get rid of $' \b'.
typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION=$'${${P9K_CONTENT/⇣* ⇡/⇣⇡}// \b}'
2019-07-20 12:46:18 +00:00
# Context format when root: user@host. The first part white, the rest grey.
2019-10-10 07:58:14 +00:00
typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%7F%n%f%242F@%m%f'
# Context format when not root: user@host. The whole thing grey.
typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%242F%n@%m%f'
# Don't show context unless root or in SSH.
typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_CONTENT_EXPANSION=
2019-07-20 12:46:18 +00:00
# Show previous command duration only if it's >= 5s.
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5
# Don't show fractional seconds. Thus, 7s rather than 7.3s.
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
# Duration format: 1d 2h 3m 4s.
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
# Yellow previous command duration.
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=yellow
}
(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
2019-09-23 17:32:39 +00:00
'builtin' 'unset' 'p10k_config_opts'