From 45bc2e16f335035a114406bea7d8ef5129a775ac Mon Sep 17 00:00:00 2001 From: Alen Date: Thu, 7 Sep 2023 23:08:41 +0100 Subject: Add basic .z{env,profile,shrc,login,logout} Set up history, cd/pushd, local bins, locales, pager, other nice-to-haves. --- dot_zshenv | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 dot_zshenv (limited to 'dot_zshenv') diff --git a/dot_zshenv b/dot_zshenv new file mode 100644 index 0000000..702bfd3 --- /dev/null +++ b/dot_zshenv @@ -0,0 +1,42 @@ +# 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 +export HISTFILE="${HOME}/.zsh_history" +export HISTSIZE=1000000 +export SAVEHIST=1000000 + +# 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 + +# (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 -- cgit 1.4.1-2-gfad0