Revise zsh config

old-yadm
earnest ma 2021-08-23 18:17:11 -04:00
parent 1c63d52218
commit 4ab09d794a
Signed by: earnest ma
GPG Key ID: A343F43342EB6E2A
1 changed files with 46 additions and 28 deletions

View File

@ -6,7 +6,6 @@ autoload -U colors && colors
# Set up the prompt
autoload -Uz promptinit
promptinit
prompt adam1
setopt histignorealldups sharehistory
@ -21,41 +20,60 @@ autoload edit-command-line; zle -N edit-command-line
bindkey '^k' edit-command-line
# History
HISTSIZE=1000
SAVEHIST=1000
setopt HIST_REDUCE_BLANKS
HISTSIZE=9000
SAVEHIST=9000
setopt extended_history
setopt hist_expire_dups_first
setopt hist_reduce_blanks
setopt hist_ignore_dups
setopt hist_ignore_space
HISTFILE=$XDG_CACHE_HOME/zshhistory
# Auto cd
setopt auto_cd
# Aliases
[ -f "$E_SCRIPTS_DIR/aliases.sh" ] && source "$E_SCRIPTS_DIR/aliases.sh"
# zsh-specific aliases
# clear zsh history: Adapted from Novimatrem: https://gitlab.com/Novimatrem/clear-bash-history
alias czh="echo 'Fully clearing history, then exiting...' && cat /dev/null > $XDG_CACHE_HOME/zshhistory && history -p && exit"
# Prompt
# PROMPT="%K{238}%F{104}%n%f%k%K{238}%F{104}@%f%k%K{238}%F{104}%m%f%k%K{238}%F{104}:%2~> %f%k"
fpath=($ZDOTDIR/completions $fpath)
_comp_options+=(globdots) # include hidden files
# Use modern completion system
autoload -Uz compinit
compinit
# reload the zsh session. From OMZ:plugins/zsh_reload
zreload() {
local cache="$ZSH_CACHE_DIR"
autoload -U compinit zrecompile
compinit -i -d "$cache/zcomp-$HOST"
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2
eval "$(dircolors -b)"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
for f in ${ZDOTDIR:-~}/.zshrc "$cache/zcomp-$HOST"; do
zrecompile -p $f && command rm -f $f.zwc.old
done
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
# Use $SHELL if available; remove leading dash if login shell
[[ -n "$SHELL" ]] && exec ${SHELL#-} || exec zsh
}
# Plugin management
[[ -f $ZDOTDIR/znap/znap.zsh ]] ||
git clone https://github.com/marlonrichert/zsh-snap $ZDOTDIR/znap
source $ZDOTDIR/znap/znap.zsh
znap source marlonrichert/zsh-autocomplete
zstyle ':autocomplete:*' min-input 1
zstyle ':autocomplete:*' min-delay 0.25
znap source hlissner/zsh-autopair
znap source zsh-users/zsh-syntax-highlighting
PURE_PROMPT_SYMBOL=
znap prompt sindresorhus/pure
zstyle :prompt:pure:git:stash show yes
znap source MichaelAquilina/zsh-you-should-use
# auto cd must be set later
setopt AUTO_CD
# Hooks
eval "$(direnv hook zsh)"