yeet zsh config
parent
e108145d46
commit
03394e276e
|
@ -3,87 +3,59 @@
|
||||||
|
|
||||||
autoload -U colors && colors
|
autoload -U colors && colors
|
||||||
|
|
||||||
# Options
|
# Set up the prompt
|
||||||
setopt auto_cd
|
autoload -Uz promptinit
|
||||||
|
promptinit
|
||||||
|
prompt adam1
|
||||||
|
|
||||||
# History
|
setopt histignorealldups sharehistory
|
||||||
setopt EXTENDED_HISTORY
|
|
||||||
setopt SHARE_HISTORY
|
|
||||||
setopt APPEND_HISTORY
|
|
||||||
# setopt INC_APPEND_HISTORY # unexpected last result with multiple open terminals
|
|
||||||
setopt HIST_REDUCE_BLANKS
|
|
||||||
HISTSIZE=10000
|
|
||||||
SAVEHIST=10000
|
|
||||||
HISTFILE=$XDG_CACHE_HOME/zshhistory
|
|
||||||
|
|
||||||
# Corrections
|
# Use emacs keybindings even if our EDITOR is set to vi
|
||||||
setopt CORRECT
|
bindkey -e
|
||||||
setopt CORRECT_ALL
|
|
||||||
|
|
||||||
# Completion
|
|
||||||
fpath=($ZDOTDIR/completions $fpath)
|
|
||||||
autoload -U compinit
|
|
||||||
zstyle ':completion:*' menu select
|
|
||||||
zmodload zsh/complist
|
|
||||||
compinit
|
|
||||||
_comp_options+=(globdots) # include hidden files
|
|
||||||
|
|
||||||
# Keybindings
|
|
||||||
bindkey -e # force Emacs state, even with $EDITOR=nvim
|
|
||||||
bindkey "^[[1;5C" forward-word
|
bindkey "^[[1;5C" forward-word
|
||||||
bindkey "^[[1;5D" backward-word
|
bindkey "^[[1;5D" backward-word
|
||||||
bindkey -s '^L' '^Uclear^M' # clear using alias
|
bindkey -s '^L' '^Uclear^M' # clear using alias
|
||||||
|
|
||||||
# edit line in editor w/ ctrl-k (from Luke Smith's .zshrc)
|
|
||||||
autoload edit-command-line; zle -N edit-command-line
|
autoload edit-command-line; zle -N edit-command-line
|
||||||
bindkey '^k' edit-command-line
|
bindkey '^k' edit-command-line
|
||||||
|
|
||||||
|
# History
|
||||||
|
HISTSIZE=1000
|
||||||
|
SAVEHIST=1000
|
||||||
|
setopt HIST_REDUCE_BLANKS
|
||||||
|
HISTFILE=$XDG_CACHE_HOME/zshhistory
|
||||||
|
|
||||||
|
# Auto cd
|
||||||
|
setopt auto_cd
|
||||||
|
|
||||||
# Aliases
|
# Aliases
|
||||||
[ -f "$E_SCRIPTS_DIR/aliases.sh" ] && source "$E_SCRIPTS_DIR/aliases.sh"
|
[ -f "$E_SCRIPTS_DIR/aliases.sh" ] && source "$E_SCRIPTS_DIR/aliases.sh"
|
||||||
|
|
||||||
# zsh-specific aliases
|
# zsh-specific aliases
|
||||||
# clear zsh history: Adapted from Novimatrem: https://gitlab.com/Novimatrem/clear-bash-history
|
# 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"
|
alias czh="echo 'Fully clearing history, then exiting...' && cat /dev/null > $XDG_CACHE_HOME/zshhistory && history -p && exit"
|
||||||
|
|
||||||
# Prompt
|
# 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"
|
# 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"
|
||||||
|
|
||||||
# Plugins! I try to keep as few as possible
|
# Use modern completion system
|
||||||
zplugin-git(){
|
autoload -Uz compinit
|
||||||
if [[ ! -d ~/.config/zsh/$1 ]]; then
|
compinit
|
||||||
git clone $2 ~/.config/zsh/$1
|
|
||||||
else
|
|
||||||
[ -z $UPDATESZ ] || git -C ~/.config/zsh/$1 pull
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# TODO without starting a new shell in shell
|
zstyle ':completion:*' auto-description 'specify: %d'
|
||||||
zplugin-git-update(){
|
zstyle ':completion:*' completer _expand _complete _correct _approximate
|
||||||
UPDATESZ=1 zsh
|
zstyle ':completion:*' format 'Completing %d'
|
||||||
}
|
zstyle ':completion:*' group-name ''
|
||||||
|
zstyle ':completion:*' menu select=2
|
||||||
# autocomplete
|
eval "$(dircolors -b)"
|
||||||
zplugin-git autocomplete https://github.com/marlonrichert/zsh-autocomplete
|
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
|
||||||
source $ZDOTDIR/autocomplete/zsh-autocomplete.plugin.zsh
|
zstyle ':completion:*' list-colors ''
|
||||||
zstyle ':autocomplete:*' min-input 1
|
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
|
||||||
zstyle ':autocomplete:*' min-delay 0.25
|
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
|
||||||
|
zstyle ':completion:*' menu select=long
|
||||||
# autopair
|
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
|
||||||
zplugin-git autopair https://github.com/hlissner/zsh-autopair
|
zstyle ':completion:*' use-compctl false
|
||||||
source ~/.config/zsh/autopair/autopair.zsh
|
zstyle ':completion:*' verbose true
|
||||||
autopair-init
|
|
||||||
|
|
||||||
autoload -Uz vcs_info
|
|
||||||
precmd_vcs_info() { vcs_info }
|
|
||||||
precmd_functions+=( precmd_vcs_info )
|
|
||||||
setopt prompt_subst
|
|
||||||
RPROMPT=\$vcs_info_msg_0_
|
|
||||||
zstyle ':vcs_info:git:*' formats '%F{240}(%b)%r%f'
|
|
||||||
zstyle ':vcs_info:*' enable git
|
|
||||||
|
|
||||||
# Direnv
|
|
||||||
eval "$(direnv hook zsh)"
|
|
||||||
|
|
||||||
# This must be placed at the end
|
|
||||||
[ -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ] && source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
|
||||||
|
|
||||||
|
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'
|
||||||
|
|
Loading…
Reference in New Issue