# `.zshrc' is sourced in interactive shells. It should contain # commands to set up aliases, functions, options, key bindings, etc. # If not running interactively, don't do anything [[ $- != *i* ]] && return autoload -U colors && colors autoload -Uz promptinit && promptinit autoload -U compinit && compinit # Init plugin handling [ -f $HOME/.local/share/miniplug.zsh ] && curl \ -sL --create-dirs \ https://git.sr.ht/~yerinalexey/miniplug/blob/master/miniplug.zsh \ -o $HOME/.local/share/miniplug.zsh source "$HOME/.local/share/miniplug.zsh" # Use emacs keybindings even if our EDITOR is set to vi bindkey -e bindkey "^[[1;5C" forward-word bindkey "^[[1;5D" backward-word bindkey -s '^L' '^Uclear^M' # clear using alias autoload edit-command-line; zle -N edit-command-line bindkey '^k' edit-command-line # History HISTORY_IGNORE="(ls|cd|pwd|exit|sudo reboot|history|cd -|cd ..)" HISTFILE="$HOME/.zsh_history" HISTSIZE=99999 SAVEHIST=90000 setopt extended_history # record timestamp of command in HISTFILE setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE setopt hist_ignore_dups # Don't add duplicate entries setopt hist_ignore_space # ignore commands that start with space setopt hist_verify # show command with history expansion to user before running it setopt inc_append_history # add commands to HISTFILE in order of execution setopt share_history # share command history data setopt hist_find_no_dups # don't display duplicates in reverse search setopt hist_reduce_blanks # remove superfluous blanks setopt interactivecomments # Comments in the interactive shell setopt auto_continue # Send CONT signal automatically when disowning jobs # pushd setopt pushd_ignore_dups export DIRSTACKSIZE=20 setopt auto_pushd # Load aliases source "$HOME/.config/shell_common/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" # Completion _comp_options+=(globdots) # include hidden files # 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" for f in ${ZDOTDIR:-~}/.zshrc "$cache/zcomp-$HOST"; do zrecompile -p $f && command rm -f $f.zwc.old done # Use $SHELL if available; remove leading dash if login shell [[ -n "$SHELL" ]] && exec ${SHELL#-} || exec zsh } # PLUGINS! # `miniplug update` miniplug plugin 'zsh-users/zsh-syntax-highlighting' miniplug plugin 'hlissner/zsh-autopair' miniplug theme 'tjquillan/pastel' miniplug load # auto cd must be set later setopt AUTO_CD # Hooks eval "$(direnv hook zsh)"