aboutsummaryrefslogtreecommitdiff
path: root/config/p10k-rainbow.zsh
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2020-03-13 12:34:50 +0300
committerromkatv <roman.perepelitsa@gmail.com>2020-03-13 12:34:50 +0300
commite4e165f6d739bce23d64b8439530035c6eba29de (patch)
tree82f15d40b13e5427a006ffc7a182779572370b8a /config/p10k-rainbow.zsh
parent0d662be14cab221fb9cbe9f2a22a3efc3a4c4836 (diff)
simplify configs
- use POWERLEVEL9K_ICON_PADDING instead of POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION to customize padding after icons - remove reliance on UTF-8 locale when the config is being sourced
Diffstat (limited to 'config/p10k-rainbow.zsh')
-rw-r--r--config/p10k-rainbow.zsh62
1 files changed, 7 insertions, 55 deletions
diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh
index 93a10a36..74957a43 100644
--- a/config/p10k-rainbow.zsh
+++ b/config/p10k-rainbow.zsh
@@ -19,16 +19,9 @@
# restarting zsh. Edit ~/.p10k.zsh and type `source ~/.p10k.zsh`.
unset -m 'POWERLEVEL9K_*'
+ # Zsh >= 5.1 is required.
autoload -Uz is-at-least && is-at-least 5.1 || return
- zmodload zsh/langinfo
- if [[ ${langinfo[CODESET]:-} != (utf|UTF)(-|)8 && $+commands[locale] == 1 ]]; then
- local -a loc
- if loc=(${(@M)$(locale -a 2>/dev/null):#*.(utf|UTF)(-|)8}) && (( $#loc )); then
- local LC_ALL=${loc[(r)(#i)C.UTF(-|)8]:-${loc[(r)(#i)en_US.UTF(-|)8]:-$loc[1]}}
- fi
- fi
-
# The list of segments shown on the left. Fill it with the most important segments.
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
# =========================[ Line #1 ]=========================
@@ -108,50 +101,11 @@
# example # example user-defined segment (see prompt_example function below)
)
- # To enable default icons for all segments, don't define POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION
- # or set it to '${P9K_VISUAL_IDENTIFIER}'.
- #
- # To remove trailing space from all default icons, set POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION
- # to '${P9K_VISUAL_IDENTIFIER% }'.
- #
- # To enable default icons for one segment (e.g., dir), set
- # POWERLEVEL9K_DIR_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}'.
- #
- # To assign a specific icon to one segment (e.g., dir), set
- # POWERLEVEL9K_DIR_VISUAL_IDENTIFIER_EXPANSION='⭐'.
- #
- # To assign a specific icon to a segment in a given state (e.g., dir in state NOT_WRITABLE),
- # set POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐'.
- #
- # Note: You can use $'\u2B50' instead of '⭐'. It's especially convenient when specifying
- # icons that your text editor cannot render. Don't forget to put $ and use single quotes when
- # defining icons via Unicode codepoints.
- #
- # Note: Many default icons cannot be displayed with system fonts. You'll need to install a
- # capable font to use them. See POWERLEVEL9K_MODE below.
- typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}'
-
- # This option makes a difference only when default icons are enabled for all or some prompt
- # segments (see POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION above). LOCK_ICON can be printed as
- # $'\uE0A2', $'\uE138' or $'\uF023' depending on POWERLEVEL9K_MODE. The correct value of this
- # parameter depends on the provider of the font your terminal is using.
- #
- # Font Provider | POWERLEVEL9K_MODE
- # ---------------------------------+-------------------
- # Powerline | powerline
- # Font Awesome | awesome-fontconfig
- # Adobe Source Code Pro | awesome-fontconfig
- # Source Code Pro | awesome-fontconfig
- # Awesome-Terminal Fonts (regular) | awesome-fontconfig
- # Awesome-Terminal Fonts (patched) | awesome-patched
- # Nerd Fonts | nerdfont-complete
- # Other | compatible
- #
- # If this looks overwhelming, either stick with a preinstalled system font and set
- # POWERLEVEL9K_MODE=compatible, or install the recommended Powerlevel10k font from
- # https://github.com/romkatv/powerlevel10k/#recommended-meslo-nerd-font-patched-for-powerlevel10k
- # and set POWERLEVEL9K_MODE=nerdfont-complete.
+ # Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you.
typeset -g POWERLEVEL9K_MODE=nerdfont-complete
+ # When set to `moderate`, some icons will have an extra space after them. This is meant to avoid
+ # icon overlap when using non-monospace fonts. When set to `none`, spaces are not added.
+ typeset -g POWERLEVEL9K_ICON_PADDING=none
# When set to true, icons appear before content on both sides of the prompt. When set
# to false, icons go after content. If empty or not set, icons go before content in the left
@@ -368,12 +322,10 @@
# Branch icon. Set this parameter to '\uF126 ' for the popular Powerline branch icon.
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=
- POWERLEVEL9K_VCS_BRANCH_ICON=${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}
# Untracked files icon. It's really a question mark, your font isn't broken.
# Change the value of this parameter to show a different icon.
typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?'
- POWERLEVEL9K_VCS_UNTRACKED_ICON=${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON}
# Formatter for Git status.
#
@@ -403,7 +355,7 @@
local res
local where # branch or tag
if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then
- res+="${clean}${POWERLEVEL9K_VCS_BRANCH_ICON}"
+ res+="${clean}${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}"
where=${(V)VCS_STATUS_LOCAL_BRANCH}
elif [[ -n $VCS_STATUS_TAG ]]; then
res+="${meta}#"
@@ -447,7 +399,7 @@
# ?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+=" ${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