# First and foremost, set up history setopt inc_append_history # append to history as commands are run rather than at the end setopt extended_history # record timestamp of command in HISTFILE setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds limits setopt hist_ignore_dups # ignore duplicated commands history list setopt hist_ignore_space # ignore commands that start with space setopt hist_verify # show command with history expansion to user before execution setopt share_history # share command history data setopt hist_find_no_dups # filter out (even non-contiguous) entries when from history search unsetopt flowcontrol # do not use ^S/^Q for flor control # Common nice-to-haves setopt auto_cd # Auto-cd into directory if only directory name used as command setopt multios # Implicit cat/tee redirection setopt prompt_subst # Prompt substitution used by themes # Directory management setopt auto_pushd # Treat cd as pushd setopt pushd_minus # Flip cd +n and cd -n relative to csh setopt pushd_silent # Do not print directories setopt pushd_to_home # No arguments is the same as pushd $HOME - mimic cd with no args setopt pushd_ignore_dups # Ignore pushd dupes export DIRSTACKSIZE=16 # Set XDG_* path vars for better compat # https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html # TODO: XDG_RUNTIME_DIR cleanup on logout [[ -v XDG_CONFIG_HONE ]] || export XDG_CONFIG_HOME=${HOME}/.config [[ -v XDG_CACHE_HOME ]] || export XDG_CACHE_HOME=${HOME}/.cache [[ -v XDG_DATA_HOME ]] || export XDG_DATA_HOME=${HOME}/.local/share [[ -v XDG_STATE_HOME ]] || export XDG_STATE_HOME=${HOME}/.local/state [[ -v XDG_DATA_DIRS ]] || export XDG_DATA_DIRS=/usr/local/share:/usr/share [[ -v XDG_CONFIG_DIRS ]] || export XDG_CONFIG_DIRS=/etc/xdg [[ -v XDG_RUNTIME_DIR ]] || export XDG_RUNTIME_DIR=${HOME}/.cache/xdg-runtime-dir # (Re)set locales, a reminder that we live in a world built upon bad decisions export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8 # Pager - this requires an updated version of less on macOS or --mouse breaks export LESS="--RAW-CONTROL-CHARS --chop-long-lines --mouse" export PAGER="less" # Add user's bin or .local/bin to PATH, if they exist if [[ -d "${HOME}/bin" ]]; then PATH="${HOME}/bin:${PATH}" fi if [[ -d "${HOME}/.local/bin" ]]; then PATH="${HOME}/.local/bin:${PATH}" fi # Never allow global pip export PIP_REQUIRE_VENV=1