Use XDG base dir vars instead of defaults
This commit is contained in:
42
zshenv
42
zshenv
@@ -2,12 +2,24 @@
|
||||
# contain commands that produce output or assume the shell is attached to a
|
||||
# tty. This file will always be sourced.
|
||||
|
||||
[ -f ~/.config/zsh/zshenv.local ] && source ~/.config/zsh/zshenv.local
|
||||
|
||||
# Ensure cache and state directories exist
|
||||
[ ! -d -${XDG_CACHE_HOME:-$HOME/.cache}/zsh ] && \
|
||||
mkdir -p ${XDG_CACHE_HOME:-$HOME/.cache}/zsh
|
||||
[ ! -d -${XDG_STATE_HOME:-$HOME/.local/state}/zsh ] && \
|
||||
mkdir -p ${XDG_STATE_HOME:-$HOME/.local/state}/zsh
|
||||
|
||||
# Enable saving command history to file
|
||||
[ ! -d $HOME/.cache/zsh ] && mkdir -p $HOME/.cache/zsh
|
||||
HISTFILE=$HOME/.cache/zsh/histfile
|
||||
HISTFILE=${XDG_STATE_HOME:-$HOME/.local/state}/zsh/histfile
|
||||
HISTSIZE=20000
|
||||
SAVEHIST=20000
|
||||
|
||||
# Migrate histfile from cache to state directory
|
||||
[ -f $HOME/.cache/zsh/histfile ] && \
|
||||
mv $HOME/.cache/zsh/histfile \
|
||||
${XDG_STATE_HOME:-$HOME/.local/state}/zsh/histfile
|
||||
|
||||
# Remove vi mode switch delay
|
||||
KEYTIMEOUT=1
|
||||
|
||||
@@ -40,8 +52,8 @@ elif [ -f /usr/bin/ccache ]; then
|
||||
PATH=/usr/lib/ccache:$PATH
|
||||
fi
|
||||
fi
|
||||
export CCACHE_CONFIGPATH=$HOME/.config/ccache
|
||||
export CCACHE_DIR=$HOME/.cache/ccache
|
||||
export CCACHE_CONFIGPATH=${XDG_CONFIG_HOME:-$HOME/.config}/ccache
|
||||
export CCACHE_DIR=${XDG_CACHE_HOME:-$HOME/.cache}/ccache
|
||||
|
||||
# Add default CMake generator
|
||||
command -v ninja &> /dev/null && \
|
||||
@@ -103,27 +115,27 @@ command -v pinentry-curses &> /dev/null && \
|
||||
export LPASS_PINENTRY=pinentry-curses
|
||||
|
||||
# Teach these some XDG Base Directory Spec manners
|
||||
export IPYTHONDIR=$HOME/.config/ipython
|
||||
export IPYTHONDIR=${XDG_CONFIG_HOME:-$HOME/.config}/ipython
|
||||
command -v cargo &> /dev/null && \
|
||||
export CARGO_HOME=$HOME/.local/share/cargo
|
||||
if command -v ccache &> /dev/null; then
|
||||
export CCACHE_CONFIGPATH=$HOME/.config/ccache.conf
|
||||
export CCACHE_DIR=$HOME/.cache/ccache
|
||||
export CCACHE_CONFIGPATH=${XDG_CONFIG_HOME:-$HOME/.config}/ccache.conf
|
||||
export CCACHE_DIR=${XDG_CACHE_HOME:-$HOME/.cache}/ccache
|
||||
fi
|
||||
command -v conan &> /dev/null && \
|
||||
export CONAN_USER_HOME=$HOME/.local/share/conan
|
||||
command -v docker &> /dev/null && \
|
||||
export DOCKER_CONFIG=$HOME/.local/share/docker
|
||||
export GTK_RC_FILES=$HOME/.config/gtk/gtkrc
|
||||
export GTK2_RC_FILES=$HOME/.config/gtk-2.0/gtkrc
|
||||
export PYLINTHOME=$HOME/.cache/pylint
|
||||
export GTK_RC_FILES=${XDG_CONFIG_HOME:-$HOME/.config}/gtk/gtkrc
|
||||
export GTK2_RC_FILES=${XDG_CONFIG_HOME:-$HOME/.config}/gtk-2.0/gtkrc
|
||||
export PYLINTHOME=${XDG_CACHE_HOME:-$HOME/.cache}/pylint
|
||||
command -v rustup &> /dev/null && \
|
||||
export RUSTUP_HOME=$HOME/.local/share/rustup
|
||||
[ -f $HOME/.config/wget/rc ] && \
|
||||
export WGETRC=$HOME/.config/wget/rc
|
||||
[ -f ${XDG_CONFIG_HOME:-$HOME/.config}/wget/rc ] && \
|
||||
export WGETRC=${XDG_CONFIG_HOME:-$HOME/.config}/wget/rc
|
||||
# TODO: terminfo
|
||||
export GOBIN=$HOME/.local/bin
|
||||
export GOPATH=$HOME/.local/share/go
|
||||
export GOCACHE=$HOME/.cache/go/build
|
||||
export GOMODCACHE=$HOME/.cache/go/pkg/mod
|
||||
export GOTMPDIR=$HOME/.cache/go/tmp
|
||||
export GOCACHE=${XDG_CACHE_HOME:-$HOME/.cache}/go/build
|
||||
export GOMODCACHE=${XDG_CACHE_HOME:-$HOME/.cache}/go/pkg/mod
|
||||
export GOTMPDIR=${XDG_CACHE_HOME:-$HOME/.cache}/go/tmp
|
||||
|
||||
Reference in New Issue
Block a user