feat: use xdg spec

This commit is contained in:
Price Hiller 2022-07-31 14:45:26 -05:00
parent 531f213f48
commit a508364ae9
4 changed files with 27 additions and 9 deletions

View File

@ -4,7 +4,25 @@ configure() {
autoload -U +X bashcompinit && bashcompinit
}
set-xdg-vars() {
# Based on https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
# and https://wiki.archlinux.org/title/XDG_Base_Directory
export XDG_CONFIG_HOME="${HOME}/.config"
export XDG_CACHE_HOME="${HOME}/.cache"
export XDG_DATA_HOME="${HOME}/.local/share"
export XDG_STATE_HOME="${HOME}/.local/state"
export XDG_DATA_DIRS="/usr/local/share:/usr/share"
export XDG_CONFIG_DIRS="/etc/xdg"
# XDG_RUNTIME_DIR
# Not set because this is generally resolved by the underlying system,
# AKA shit can break bad if this is set wrong
}
init() {
set-xdg-vars
local wkdir="${BASE_ZSH_CONFIG_DIR}/config"
source "${wkdir}/themes/init.zsh"
source "${wkdir}/profile/init.zsh"

View File

@ -36,7 +36,7 @@ configure() {
init() {
local wkdir="${BASE_ZSH_CONFIG_DIR}/config/omz"
export ZSH="${HOME}/.local/share/omz"
export ZSH="${XDG_DATA_HOME}/omz"
export ZSH_CUSTOM="${wkdir}/"
}

View File

@ -1,6 +1,6 @@
#!/usr/bin/env zsh
export PATH="${PATH}:${HOME}/.local/bin"
export PATH="${PATH}:${XDG_BIN_HOME}"
### Shell ###
export LANG=en_US.UTF-8
@ -9,19 +9,19 @@ export ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=2
export ZSH_AUTOSUGGEST_STRATEGY=(history completion)
### Autojump ###
source "${HOME}/.local/share/autojump/etc/profile.d/autojump.sh"
export PATH="${PATH}:${HOME}/.local/share/autojump/bin"
source "${XDG_DATA_HOME}/autojump/etc/profile.d/autojump.sh"
export PATH="${PATH}:${XDG_DATA_HOME}/autojump/bin"
### FZF ###
function zvm_after_init() {
[[ -r "${HOME}/.config/fzf/fzf.zsh" ]] && source "${HOME}/.config/fzf/fzf.zsh"
[[ -r "${XDG_CONFIG_HOME}/fzf/fzf.zsh" ]] && source "${XDG_CONFIG_HOME}/fzf/fzf.zsh"
}
export FZF_DEFAULT_COMMAND='fd --hidden --exclude .git --color=always'
export FZF_DEFAULT_OPTS="--height=80% --layout=reverse --info=inline --border --margin=1 --ansi"
export FZF_CTRL_T_COMMAND="${FZF_DEFAULT_COMMAND}"
### Python ###
export PYENV_ROOT="${HOME}/.local/share/pyenv"
export PYENV_ROOT="${XDG_DATA_HOME}/pyenv"
export PATH="${PATH}:${PYENV_ROOT}/bin"
eval "$(pyenv init -)"
@ -84,9 +84,9 @@ else
fi
### Rust ###
export CARGO_HOME="${HOME}/.local/share/cargo"
export CARGO_HOME="${XDG_DATA_HOME}/cargo"
source "${CARGO_HOME}/env"
export RUSTUP_HOME="${HOME}/.local/share/rustup"
export RUSTUP_HOME="${XDG_DATA_HOME}/rustup"
export PATH="${PATH}:${CARGO_HOME}/bin"
### Terminal Specific ###

View File

@ -1,7 +1,7 @@
configure() {
# Enable Caching
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path "${HOME}/.cache/.zcompcache"
zstyle ':completion:*' cache-path "${XDG_CACHE_HOME}/.zcompcache"
### Fzf Tab Configuration ###
zstyle ':fzf-tab:*' fzf-pad 100