blob: 4cae70b703f33c5df9f61b3ec6ccb4c1b9b518b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# 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 ~/.local paths to {,MAN,INFO}PATH and fpath
export PATH="${HOME}/.local/bin${PATH:+:${PATH}}"
export MANPATH="${XDG_DATA_HOME:-${HOME}/.local/share}/man${MANPATH:+:${MANPATH}}"
export INFOPATH="${XDG_DATA_HOME:-${HOME}/.local/share}/info${INFOPATH:+:${INFOPATH}}"
fpath=(
"${ZDOTDIR:-${HOME}/.config/zsh}/functions"
"${XDG_DATA_HOME:-${HOME}/.local/share}/zsh/site-functions"
$fpath
)
# Back these up as they could get mangled in system profile
# TODO: Restore them in zshrc?
export __PATH="${PATH}"
export __MANPATH="${MANPATH}"
export __INFOPATH="${INFOPATH}"
# Never allow global pip
export PIP_REQUIRE_VENV=1
|