Refactor zsh and sh rcs
This commit is contained in:
parent
0e6e61c470
commit
52b054a2d2
5 changed files with 37 additions and 104 deletions
|
|
@ -348,7 +348,7 @@
|
|||
|
||||
# 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='?'
|
||||
typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='…'
|
||||
POWERLEVEL9K_VCS_UNTRACKED_ICON=${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON}
|
||||
|
||||
# Formatter for Git status.
|
||||
|
|
@ -409,19 +409,19 @@
|
|||
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.
|
||||
# ⇣42 if behind the remote. customized to ↓
|
||||
(( 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. ch to ↑
|
||||
(( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && res+=" "
|
||||
(( VCS_STATUS_COMMITS_AHEAD )) && res+="${clean}⇡${VCS_STATUS_COMMITS_AHEAD}"
|
||||
(( VCS_STATUS_COMMITS_AHEAD )) && res+="${clean}↑${VCS_STATUS_COMMITS_AHEAD}"
|
||||
# *42 if have stashes.
|
||||
(( VCS_STATUS_STASHES )) && res+=" ${clean}*${VCS_STATUS_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}"
|
||||
(( 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}"
|
||||
(( 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.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
#!/usr/bin/env zsh
|
||||
#
|
||||
|
||||
CONFDIR="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
ZSHCONFDIR="$CONFDIR/zsh"
|
||||
|
||||
# Set completion style
|
||||
# The following lines were added by compinstall
|
||||
zstyle ':completion:*' completer _complete _ignored _approximate
|
||||
|
|
@ -8,7 +11,7 @@ zstyle ':completion:*' list-colors ''
|
|||
zstyle ':completion:*' matcher-list '' '+m:{[:lower:]}={[:upper:]} r:|[._-]=** r:|=**'
|
||||
zstyle ':completion:*' menu select=1
|
||||
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
|
||||
zstyle :compinstall filename '/home/marty/.config/zsh/.zshrc'
|
||||
zstyle :compinstall filename "$ZSHCONFDIR/.zshrc"
|
||||
# End of lines added by compinstall
|
||||
autoload -Uz compinit zmv
|
||||
compinit
|
||||
|
|
@ -22,13 +25,13 @@ fi
|
|||
|
||||
|
||||
# load all plugins
|
||||
[ -f "$XDG_CONFIG_HOME/zsh/plugins.zsh" ] && source "$XDG_CONFIG_HOME/zsh/plugins.zsh"
|
||||
[ -f "$ZSHCONFDIR/plugins.zsh" ] && source "$ZSHCONFDIR/plugins.zsh"
|
||||
|
||||
# shellcheck source=alias
|
||||
[ -f "$XDG_CONFIG_HOME/sh/alias" ] && source "$XDG_CONFIG_HOME/sh/alias"
|
||||
[ -f "$CONFDIR/sh/alias" ] && source "$CONFDIR/sh/alias"
|
||||
# load additional aliases
|
||||
if [ -d "$XDG_CONFIG_HOME/sh/alias.d" ]; then
|
||||
for _alias in "$XDG_CONFIG_HOME/sh/alias.d"/*.sh; do
|
||||
if [ -d "$CONFDIR/sh/alias.d" ]; then
|
||||
for _alias in "$CONFDIR/sh/alias.d"/*.sh; do
|
||||
. "$_alias"
|
||||
done
|
||||
unset _alias
|
||||
|
|
@ -44,7 +47,7 @@ ENABLE_CORRECTION="true"
|
|||
# Speed up autocomplete, force prefix mapping
|
||||
zstyle ':completion:*' accept-exact '*(N)'
|
||||
zstyle ':completion:*' use-cache on
|
||||
zstyle ':completion:*' cache-path ~/.zsh/cache
|
||||
zstyle ':completion:*' cache-path "${XDG_CACHE_HOME:-$HOME/.cache}/zshcompcache"
|
||||
# shellcheck disable=SC2016
|
||||
zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)*==34=34}:${(s.:.)LS_COLORS}")'
|
||||
|
||||
|
|
@ -67,6 +70,7 @@ export HISTSIZE=100000
|
|||
export SAVEHIST=100000
|
||||
export HISTFILE="$XDG_DATA_HOME/zsh_history"
|
||||
export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"
|
||||
|
||||
## Set ZSH History aliases
|
||||
# Show the top 5 commands used in recent history
|
||||
history_top() {
|
||||
|
|
@ -89,11 +93,7 @@ bindkey " " globalias
|
|||
bindkey "^ " magic-space # control-space to bypass completion
|
||||
bindkey -M isearch " " magic-space # normal space during searches
|
||||
|
||||
# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh.
|
||||
[[ ! -f "$XDG_CONFIG_HOME"/zsh/.p10k.zsh ]] || source "$XDG_CONFIG_HOME"/zsh/.p10k.zsh
|
||||
|
||||
# In case a plugin adds a redundant path entry, remove duplicate entries
|
||||
# from PATH
|
||||
# Deduplicate PATH - remove any duplicate entries from PATH
|
||||
# from: https://unix.stackexchange.com/questions/40749/remove-duplicate-path-entries-with-awk-command
|
||||
get_var() {
|
||||
eval 'printf "%s\n" "${'"$1"'}"'
|
||||
|
|
@ -110,3 +110,8 @@ dedup_pathvar() {
|
|||
dedup_pathvar PATH
|
||||
dedup_pathvar MANPATH
|
||||
|
||||
# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh.
|
||||
[[ ! -f "$ZSHCONFDIR/.p10k.zsh" ]] || source "$ZSHCONFDIR/.p10k.zsh"
|
||||
|
||||
unset CONFDIR
|
||||
unset ZSHCONFDIR
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue