Reorganize code

This commit is contained in:
Alex D. 2021-07-27 17:59:17 +00:00
parent d11ea19c1e
commit de8ae85455
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
35 changed files with 330 additions and 214 deletions

12
.gitmodules vendored
View File

@ -1,9 +1,9 @@
[submodule "powerlevel10k"]
path = powerlevel10k
[submodule "extern/powerlevel10k"]
path = extern/powerlevel10k
url = https://github.com/romkatv/powerlevel10k
[submodule "zsh-autosuggestions"]
path = zsh-autosuggestions
[submodule "extern/zsh-autosuggestions"]
path = extern/zsh-autosuggestions
url = https://github.com/zsh-users/zsh-autosuggestions
[submodule "zsh-syntax-highlighting"]
path = zsh-syntax-highlighting
[submodule "extern/zsh-syntax-highlighting"]
path = extern/zsh-syntax-highlighting
url = https://github.com/zsh-users/zsh-syntax-highlighting

19
.zshrc
View File

@ -1,3 +1,16 @@
source "${ZDOTDIR}/preferences.zsh"
source "${ZDOTDIR}/completions.zsh"
source "${ZDOTDIR}/bindings.zsh"
typeset -g EXTERN_PLUGINS="$ZDOTDIR/extern/"
source "$ZDOTDIR/options.zsh"
source "$ZDOTDIR/completions.zsh"
source "$ZDOTDIR/input.zsh"
# Checks if the plugin exists before loading it's settings
[ -r "$EXTERN_PLUGINS/zsh-autosuggestions/zsh-autosuggestions.zsh" ] && source "$ZDOTDIR/autosuggestions.zsh"
[ -r "$EXTERN_PLUGINS/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ] && source "$ZDOTDIR/syntax.zsh"
if [ -r "$EXTERN_PLUGINS/powerlevel10k/powerlevel10k.zsh-theme" ]; then
source "$ZDOTDIR/p10k.zsh"
else
# Fallback builtin prompt
source "$ZDOTDIR/clint.zsh"
fi

4
autosuggestions.zsh Normal file
View File

@ -0,0 +1,4 @@
source "$EXTERN_PLUGINS/zsh-autosuggestions/zsh-autosuggestions.zsh"
typeset -g ZSH_AUTOSUGGEST_STRATEGY=(completion history)
typeset -g ZSH_AUTOSUGGEST_USE_ASYNC=true

4
clint.zsh Normal file
View File

@ -0,0 +1,4 @@
autoload -Uz promptinit vcs_info
zstyle ':vcs_info:*' enable git svn
promptinit
prompt clint

1
extern/powerlevel10k vendored Submodule

@ -0,0 +1 @@
Subproject commit 8f798f986a02eb27c4ef25229976443fa2a66809

1
extern/zsh-autosuggestions vendored Submodule

@ -0,0 +1 @@
Subproject commit a411ef3e0992d4839f0732ebeb9823024afaaaa8

1
extern/zsh-syntax-highlighting vendored Submodule

@ -0,0 +1 @@
Subproject commit dffe304567c86f06bf1be0fce200077504e79783

View File

@ -1,7 +1,7 @@
# https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/key-bindings.zsh
# https://wiki.archlinux.org/index.php/Zsh
bindkey -v
bindkey -v # vi mode for input
typeset -g -A key
key[Home]="${terminfo[khome]}"

53
options.zsh Normal file
View File

@ -0,0 +1,53 @@
typeset -g ZLE_RPROMPT_INDENT=0
# Pager
typeset -g READNULLCMD=less
export LESS=-iRFXM
if autoload -U colors && colors; then
export LESS_TERMCAP_md=$'\e['"${color[bold]};${color[red]}"'m'
export LESS_TERMCAP_us=$'\e['"${color[bold]};${color[green]}"'m'
export LESS_TERMCAP_so=$'\e['"${color[bold]};${color[yellow]}"'m'
export LESS_TERMCAP_{me,se,ue,mb}=$'\e['"${color[none]}"'m'
fi
# Completion
setopt auto_list # Automatically list on ambiguous completion
setopt auto_menu # Automatically use menu completion
setopt auto_param_slash # Automatically add slash to completion
setopt glob_complete # Don't automatically expand glob patterns
setopt no_list_beep # No annoying beeps on completion
setopt list_packed # Pack completion results
setopt list_types # File type in completions
setopt menu_complete # Automatically insert first match
# Globbing
setopt glob # Enable globbing
setopt glob_star_short # Enable short ** and ***
setopt mark_dirs # Append slash when directories are matched by glob
setopt no_match # Error on no matches
# History
typeset -g HISTSIZE=1000
typeset -g SAVEHIST=1000
setopt append_history # Append to history file
setopt extended_history # Duration and timestamp in history
setopt no_hist_beep # Don't beep for history searches
setopt hist_fcntl_lock # Lock history file with fcntl
setopt hist_ignore_all_dups # Ignore history duplicates
setopt hist_ignore_space # Don't add entries to history that have a space prefix
setopt hist_reduce_blanks # Reduce blanks in history
setopt inc_append_history_time # Append history post-execution
setopt share_history # Share history between sessions
# Job control
setopt auto_continue # Automatically continue disowned jobs
setopt bg_nice # Automatically run jobs in big at lower priority
setopt no_check_jobs # Don't warn about jobs on exit
setopt notify # Show job status asap
# Misc
setopt auto_cd # Automatically change directory without cd
setopt c_bases # Show values like C understands them
setopt interactive_comments # Allow comments in interactive shells
setopt path_dirs # Match binaries in subdirectories for path
setopt short_loops # Allow short loop versions

235
p10k.zsh Normal file
View File

@ -0,0 +1,235 @@
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##/}/}

View File

@ -1,5 +0,0 @@
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=0
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND=3
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'

View File

@ -1,9 +0,0 @@
typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1
typeset -g POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND=0
typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_FOREGROUND=3
typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_BACKGROUND=0
typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=3
typeset -g POWERLEVEL9K_CONTEXT_BACKGROUND=0
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'

View File

@ -1,18 +0,0 @@
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
typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=255
typeset -g POWERLEVEL9K_DIR_FOREGROUND=254

View File

@ -1,2 +0,0 @@
typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=90
typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=95

View File

@ -1,6 +0,0 @@
typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
typeset -g POWERLEVEL9K_MODE=nerdfont-complete
typeset -g POWERLEVEL9K_ICON_PADDING=none
typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
typeset -g POWERLEVEL9K_USE_CACHE=true

View File

@ -1,3 +0,0 @@
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_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION=''

View File

@ -1,2 +0,0 @@
fpath+=("${ZDOTDIR}/powerlevel-config/segments")
autoload -Uz prompt_c_{covid_19,docker_host,mpv,new_mail,todo,weather,newsboat,mumble,sfeed,twitch,irc,apk}

View File

@ -1,9 +0,0 @@
typeset -g POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR='\uE0BD'
typeset -g POWERLEVEL9K_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=

View File

@ -1,4 +0,0 @@
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=''

View File

@ -1 +0,0 @@
typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false

View File

@ -1,82 +0,0 @@
function my_git_formatter() {
emulate -L zsh
if [[ -n $P9K_CONTENT ]]; then
# If P9K_CONTENT is not empty, use it. It's either "loading" or from vcs_info (not from
# gitstatus plugin). VCS_STATUS_* parameters are not available in this case.
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
local where # branch or tag
if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then
res+="${clean}${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}"
where=${(V)VCS_STATUS_LOCAL_BRANCH}
elif [[ -n $VCS_STATUS_TAG ]]; then
res+="${meta}#"
where=${(V)VCS_STATUS_TAG}
fi
# If local branch name or tag 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.
(( $#where > 32 )) && where[13,-13]="…"
res+="${clean}${where//\%/%%}" # escape %
# Display the current Git commit if there is no branch or tag.
# Tip: To always display the current Git commit, remove `[[ -z $where ]] &&` from the next line.
[[ -z $where ]] && 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//\%/%%}" # escape %
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_STAGED_MAX_NUM=-1
typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON=?
typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true
typeset -g POWERLEVEL9K_VCS_LOADING_TEXT=
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

View File

@ -1,9 +0,0 @@
typeset -g POWERLEVEL9K_VI_MODE_FOREGROUND=0
typeset -g POWERLEVEL9K_VI_COMMAND_MODE_STRING=N
typeset -g POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND=2
typeset -g POWERLEVEL9K_VI_VISUAL_MODE_STRING=V
typeset -g POWERLEVEL9K_VI_MODE_VISUAL_BACKGROUND=3
typeset -g POWERLEVEL9K_VI_OVERWRITE_MODE_STRING=O
typeset -g POWERLEVEL9K_VI_MODE_OVERWRITE_BACKGROUND=1
typeset -g POWERLEVEL9K_VI_INSERT_MODE_STRING=I
typeset -g POWERLEVEL9K_VI_MODE_INSERT_BACKGROUND=4

@ -1 +0,0 @@
Subproject commit 00232d1b6de0931fd9394bc3f963afb88644447d

View File

@ -1,51 +0,0 @@
typeset -g HISTSIZE=1000
typeset -g SAVEHIST=1000
typeset -g ZLE_RPROMPT_INDENT=0
# Pager and man stuff
typeset -g READNULLCMD=less
export LESS=-iRFXM
export LESS_TERMCAP_md=$'\e[01;31m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[01;32m'
setopt histappend autocd auto_param_slash c_bases extendedglob nomatch notify hist_ignore_all_dups hist_ignore_space share_history nobeep listpacked markdirs extendedhistory histfcntllock
if [[ -r "${ZDOTDIR}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]]; then
typeset -g ZSH_HIGHLIGHT_HIGHLIGHTERS=(
main
brackets
pattern
cursor
)
source ${ZDOTDIR}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
fi
if [[ -r "${ZDOTDIR}/zsh-autosuggestions/zsh-autosuggestions.zsh" ]]; then
typeset -g ZSH_AUTOSUGGEST_STRATEGY=(completion history)
typeset -g ZSH_AUTOSUGGEST_USE_ASYNC=true
source ${ZDOTDIR}/zsh-autosuggestions/zsh-autosuggestions.zsh
fi
zstyle -s ':custom:preferences' prompt _cur_prompt
if [[ $_cur_prompt == "p9k" ]] && [[ -r "${ZDOTDIR}/powerlevel10k/powerlevel10k.zsh-theme" ]]; then
source ${ZDOTDIR}/powerlevel-config/command.zsh
source ${ZDOTDIR}/powerlevel-config/context.zsh
source ${ZDOTDIR}/powerlevel-config/dir.zsh
source ${ZDOTDIR}/powerlevel-config/disk.zsh
source ${ZDOTDIR}/powerlevel-config/misc.zsh
source ${ZDOTDIR}/powerlevel-config/prompt-char.zsh
source ${ZDOTDIR}/powerlevel-config/separators.zsh
source ${ZDOTDIR}/powerlevel-config/segments.zsh
source ${ZDOTDIR}/powerlevel-config/status.zsh
source ${ZDOTDIR}/powerlevel-config/time.zsh
source ${ZDOTDIR}/powerlevel-config/vcs.zsh
source ${ZDOTDIR}/powerlevel-config/vi-mode.zsh
source ${ZDOTDIR}/powerlevel10k/powerlevel10k.zsh-theme
else
autoload -Uz promptinit
promptinit
prompt clint
fi

8
syntax.zsh Normal file
View File

@ -0,0 +1,8 @@
source "$EXTERN_PLUGINS/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
typeset -g ZSH_HIGHLIGHT_HIGHLIGHTERS=(
main
brackets
pattern
cursor
)

@ -1 +0,0 @@
Subproject commit ae315ded4dba10685dbbafbfa2ff3c1aefeb490d

@ -1 +0,0 @@
Subproject commit 5eb494852ebb99cf5c2c2bffee6b74e6f1bf38d0