mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-18 05:40:07 +00:00
Merging dritter's light color configuration.
Resolved some minor conflicts, and changed README.
This commit is contained in:
commit
86be908bd2
2 changed files with 46 additions and 23 deletions
|
@ -24,6 +24,7 @@ information.
|
|||
* Will conditionally display the `user@host` string
|
||||
* Plenty of other segments you can enable if you want them (e.g., ruby, AWS)
|
||||
* Can be used as a single or double-lined prompt (see screenshots below)
|
||||
* Several built-in color configurations to choose from
|
||||
|
||||
**If you would like an OMZ theme that provides most of the same features but
|
||||
doesn't require Powerline fonts, check out the sister font,
|
||||
|
@ -114,6 +115,13 @@ define `POWERLEVEL9K_PROMPT_ON_NEWLINE` in your `~/.zshrc`:
|
|||
|
||||
export POWERLEVEL9K_PROMPT_ON_NEWLINE=true
|
||||
|
||||
#### Light Color Theme
|
||||
|
||||
If you prefer to use "light" colors, simply set `POWERLEVEL9K_COLOR_SCHEME`
|
||||
to `light` in your `~/.zshrc`, and you're all set!
|
||||
|
||||
POWERLEVEL9K_COLOR_SCHEME='light'
|
||||
|
||||
### Bugs / Contact
|
||||
|
||||
If you have any requests or bug reports, please use the tracker in this Github
|
||||
|
|
|
@ -29,7 +29,22 @@ VCS_UNSTAGED_ICON='●'
|
|||
VCS_STAGED_ICON='✚'
|
||||
|
||||
################################################################
|
||||
# vcs_info settings
|
||||
# color scheme
|
||||
################################################################
|
||||
|
||||
local DEFAULT_COLOR DEFAULT_COLOR_INVERTED DEFAULT_COLOR_DARK
|
||||
if [[ $POWERLEVEL9K_COLOR_SCHEME == "light" ]]; then
|
||||
DEFAULT_COLOR=white
|
||||
DEFAULT_COLOR_INVERTED=black
|
||||
DEFAULT_COLOR_DARK="252"
|
||||
else
|
||||
DEFAULT_COLOR=black
|
||||
DEFAULT_COLOR_INVERTED=white
|
||||
DEFAULT_COLOR_DARK="236"
|
||||
fi
|
||||
|
||||
################################################################
|
||||
# VCS Information Settings
|
||||
################################################################
|
||||
|
||||
setopt prompt_subst
|
||||
|
@ -39,17 +54,17 @@ local VCS_WORKDIR_DIRTY=false
|
|||
local VCS_CHANGESET_PREFIX=''
|
||||
if [ $POWERLEVEL9K_SHOW_CHANGESET ]; then
|
||||
# Just display the first 12 characters of our changeset-ID.
|
||||
VCS_CHANGESET_PREFIX='%12.12i@'
|
||||
VCS_CHANGESET_PREFIX="%F{$DEFAULT_COLOR_DARK}%12.12i@%f"
|
||||
fi
|
||||
|
||||
zstyle ':vcs_info:*' enable git hg
|
||||
zstyle ':vcs_info:*' check-for-changes true
|
||||
|
||||
zstyle ':vcs_info:*' formats " $VCS_CHANGESET_PREFIX%b%c%u%m"
|
||||
zstyle ':vcs_info:*' formats " $VCS_CHANGESET_PREFIX%F{$DEFAULT_COLOR}%b%c%u%m%f"
|
||||
zstyle ':vcs_info:*' actionformats " %b %F{red}| %a%f"
|
||||
|
||||
zstyle ':vcs_info:*' stagedstr " %F{black}$VCS_STAGED_ICON%f"
|
||||
zstyle ':vcs_info:*' unstagedstr " %F{black}$VCS_UNSTAGED_ICON%f"
|
||||
zstyle ':vcs_info:*' stagedstr " %F{$DEFAULT_COLOR}$VCS_STAGED_ICON%f"
|
||||
zstyle ':vcs_info:*' unstagedstr " %F{$DEFAULT_COLOR}$VCS_UNSTAGED_ICON%f"
|
||||
|
||||
zstyle ':vcs_info:git*+set-message:*' hooks git-untracked git-aheadbehind git-remotebranch git-tagname
|
||||
|
||||
|
@ -120,7 +135,7 @@ right_prompt_segment() {
|
|||
# Note that if $DEFAULT_USER is not set, this prompt segment will always print
|
||||
prompt_context() {
|
||||
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
|
||||
$1_prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m"
|
||||
$1_prompt_segment $DEFAULT_COLOR "011" "%(!.%{%F{yellow}%}.)$USER@%m"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -130,19 +145,19 @@ prompt_vcs() {
|
|||
|
||||
if [[ -n $vcs_prompt ]]; then
|
||||
if ( $VCS_WORKDIR_DIRTY ); then
|
||||
$1_prompt_segment yellow black
|
||||
$1_prompt_segment yellow $DEFAULT_COLOR
|
||||
else
|
||||
$1_prompt_segment green black
|
||||
$1_prompt_segment green $DEFAULT_COLOR
|
||||
fi
|
||||
|
||||
echo -n "$vcs_prompt"
|
||||
echo -n "%F{$DEFAULT_COLOR}%f$vcs_prompt"
|
||||
fi
|
||||
}
|
||||
|
||||
function +vi-git-untracked() {
|
||||
if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' && \
|
||||
$(git ls-files --others --exclude-standard | sed q | wc -l | tr -d ' ') != 0 ]]; then
|
||||
hook_com[unstaged]+=" %F{black}?%f"
|
||||
hook_com[unstaged]+=" %F{$DEFAULT_COLOR}?%f"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -155,12 +170,12 @@ function +vi-git-aheadbehind() {
|
|||
# for git prior to 1.7
|
||||
# ahead=$(git rev-list origin/${branch_name}..HEAD | wc -l)
|
||||
ahead=$(git rev-list ${branch_name}@{upstream}..HEAD 2>/dev/null | wc -l | tr -d ' ')
|
||||
(( $ahead )) && gitstatus+=( " %F{black}↑${ahead}%f" )
|
||||
(( $ahead )) && gitstatus+=( " %F{$DEFAULT_COLOR}↑${ahead}%f" )
|
||||
|
||||
# for git prior to 1.7
|
||||
# behind=$(git rev-list HEAD..origin/${branch_name} | wc -l)
|
||||
behind=$(git rev-list HEAD..${branch_name}@{upstream} 2>/dev/null | wc -l | tr -d ' ')
|
||||
(( $behind )) && gitstatus+=( " %F{black}↓${behind}%f" )
|
||||
(( $behind )) && gitstatus+=( " %F{$DEFAULT_COLOR}↓${behind}%f" )
|
||||
|
||||
hook_com[misc]+=${(j::)gitstatus}
|
||||
}
|
||||
|
@ -172,12 +187,12 @@ function +vi-git-remotebranch() {
|
|||
remote=${$(git rev-parse --verify HEAD@{upstream} --symbolic-full-name 2>/dev/null)/refs\/(remotes|heads)\/}
|
||||
branch_name=${$(git symbolic-ref --short HEAD 2>/dev/null)}
|
||||
|
||||
hook_com[branch]="%F{black}${hook_com[branch]}%f"
|
||||
hook_com[branch]="%F{$DEFAULT_COLOR}${hook_com[branch]}%f"
|
||||
# Always show the remote
|
||||
#if [[ -n ${remote} ]] ; then
|
||||
# Only show the remote if it differs from the local
|
||||
if [[ -n ${remote} && ${remote#*/} != ${branch_name} ]] ; then
|
||||
hook_com[branch]+="%F{black}→%f%F{black}${remote}%f"
|
||||
hook_com[branch]+="%F{$DEFAULT_COLOR}→%f%F{$DEFAULT_COLOR}${remote}%f"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -185,7 +200,7 @@ function +vi-git-tagname() {
|
|||
local tag
|
||||
|
||||
tag=$(git describe --tags --exact-match HEAD 2>/dev/null)
|
||||
[[ -n ${tag} ]] && hook_com[branch]=" %F{black}${tag}%f"
|
||||
[[ -n ${tag} ]] && hook_com[branch]=" %F{$DEFAULT_COLOR}${tag}%f"
|
||||
}
|
||||
|
||||
function +vi-vcs-detect-changes() {
|
||||
|
@ -198,7 +213,7 @@ function +vi-vcs-detect-changes() {
|
|||
|
||||
# Dir: current working directory
|
||||
prompt_dir() {
|
||||
$1_prompt_segment blue black '%~'
|
||||
$1_prompt_segment blue $DEFAULT_COLOR '%~'
|
||||
}
|
||||
|
||||
# Virtualenv: current working virtualenv
|
||||
|
@ -207,7 +222,7 @@ prompt_dir() {
|
|||
prompt_virtualenv() {
|
||||
local virtualenv_path="$VIRTUAL_ENV"
|
||||
if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
|
||||
$1_prompt_segment blue black "(`basename $virtualenv_path`)"
|
||||
$1_prompt_segment blue $DEFAULT_COLOR "(`basename $virtualenv_path`)"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -220,7 +235,7 @@ prompt_status() {
|
|||
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
|
||||
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
|
||||
|
||||
[[ -n "$symbols" ]] && $1_prompt_segment black default "$symbols"
|
||||
[[ -n "$symbols" ]] && $1_prompt_segment $DEFAULT_COLOR default "$symbols"
|
||||
}
|
||||
|
||||
# Right Status: (return code, root status, background jobs)
|
||||
|
@ -241,17 +256,17 @@ prompt_longstatus() {
|
|||
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
|
||||
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
|
||||
|
||||
[[ -n "$symbols" ]] && $1_prompt_segment $bg default "$symbols"
|
||||
[[ -n "$symbols" ]] && $1_prompt_segment $bg $DEFAULT_COLOR "$symbols"
|
||||
}
|
||||
|
||||
# System time
|
||||
prompt_time() {
|
||||
$1_prompt_segment white black '%D{%H:%M:%S} '
|
||||
$1_prompt_segment $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR '%D{%H:%M:%S} '
|
||||
}
|
||||
|
||||
# Command number (in local history)
|
||||
prompt_history() {
|
||||
$1_prompt_segment "244" black '%h'
|
||||
$1_prompt_segment "244" $DEFAULT_COLOR '%h'
|
||||
}
|
||||
|
||||
# Ruby Version Manager information
|
||||
|
@ -259,14 +274,14 @@ prompt_rvm() {
|
|||
local rvm_prompt
|
||||
rvm_prompt=`rvm-prompt`
|
||||
if [ "$rvm_prompt" != "" ]; then
|
||||
$1_prompt_segment "240" white "$rvm_prompt "
|
||||
$1_prompt_segment "240" $DEFAULT_COLOR "$rvm_prompt "
|
||||
fi
|
||||
}
|
||||
|
||||
# rbenv information
|
||||
prompt_rbenv() {
|
||||
if [[ -n "$RBENV_VERSION" ]]; then
|
||||
$1_prompt_segment red black "$RBENV_VERSION"
|
||||
$1_prompt_segment red $DEFAULT_COLOR "$RBENV_VERSION"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue