Skip to content

Instantly share code, notes, and snippets.

@romkatv
Created September 23, 2019 12:08
Show Gist options
  • Save romkatv/7f48d0deae7a3449f34a4870feaba0f5 to your computer and use it in GitHub Desktop.
Save romkatv/7f48d0deae7a3449f34a4870feaba0f5 to your computer and use it in GitHub Desktop.
p10k-bar.zsh
# Config for Powerlevel10k ZSH theme (https://github.com/romkatv/powerlevel10k/) that emulates
# the appearance of Bar ZSH theme (https://github.com/anki-code/zsh-bar-theme).
() {
emulate -L zsh
setopt no_unset
# Unset all configuration options.
unset -m 'POWERLEVEL9K_*'
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
context # user@host
dir # current directory
newline # \n
prompt_char # prompt symbol
)
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
vcs # git status
anaconda # conda environment (https://conda.io/)
time # current time
)
# Default light grey background.
typeset -g POWERLEVEL9K_BACKGROUND=234
# No spaces around segments.
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE=
# Separate segments with a grey space.
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{,SUB}SEGMENT_SEPARATOR='%K{234} '
# No left prompt terminator.
typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=
# No right prompt terminator.
typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL=
# Disable all segment icons.
typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION=
# Add an empty line before each prompt.
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
# Fill the gap between the left and right prompt on the first line with grey spaces.
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' '
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_BACKGROUND=234
# Grey user@host.
typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=244
typeset -g POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true
# White current directory.
typeset -g POWERLEVEL9K_DIR_FOREGROUND=253
# Conda environment: white text on light grey background.
typeset -g POWERLEVEL9K_ANACONDA_FOREGROUND=254
typeset -g POWERLEVEL9K_ANACONDA_BACKGROUND=236
# Surround conda environment with spaces.
typeset -g POWERLEVEL9K_ANACONDA_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE=' '
# Don't show Python version next to the conda environment name.
typeset -g POWERLEVEL9K_ANACONDA_SHOW_PYTHON_VERSION=false
# Don't bracket conda environment.
typeset -g POWERLEVEL9K_ANACONDA_{LEFT,RIGHT}_DELIMITER=
# Git status: white text on light grey background.
typeset -g POWERLEVEL9K_VCS_FOREGROUND=250
typeset -g POWERLEVEL9K_VCS_BACKGROUND=236
# Git status format: 'master!'. The exclamation mark means the repo is dirty.
local vcs=
# 'master' or '@72f5c8a' if not on a branch.
vcs+='${${VCS_STATUS_LOCAL_BRANCH//\%/%%}:-@${VCS_STATUS_COMMIT:0:8}}'
# '!' if dirty.
vcs+='${${${:-$VCS_STATUS_HAS_STAGED$VCS_STATUS_HAS_UNSTAGED$VCS_STATUS_HAS_UNTRACKED}:#000}:+%1F!}'
# Disable the default Git status formatting.
typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true
# Install our own Git status formatter. Keep $P9K_CONTENT if it's not empty -- it's "loading".
typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION="\${P9K_CONTENT:-$vcs}"
# Surround Git status with spaces.
typeset -g POWERLEVEL9K_VCS_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE=' '
# Grey current time.
typeset -g POWERLEVEL9K_TIME_FOREGROUND=244
# Current time format: 2019-09-24 09:51:02+0200. See `man 3 strftime`.
typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%F %H:%M:%S%z}'
# Prompt symbol: bright white '#' (root) or regular '$' (non-root) on transparent background.
typeset -g POWERLEVEL9K_PROMPT_CHAR_CONTENT_EXPANSION='%(#.%255F#.%250F\$)'
typeset -g POWERLEVEL9K_PROMPT_CHAR_BACKGROUND=
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment