From 8a5408c002c60af2c9519865da72d3958dd8f836 Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Mon, 10 Aug 2020 21:58:23 +0100 Subject: [PATCH] zsh: rearrange files into sane XDG dirs Move non-config into XDG_DATA_HOME including Antigen and ZSH history files. Signed-off-by: Joe Groocock --- .config/zsh/.zshrc | 14 ++++++-------- .profile | 1 + 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 9d5fed7..2032a7e 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,13 +1,12 @@ # Config and cache directory paths -CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}" -ZSH_DIR="$CONFIG_DIR/zsh" -LOG_DIR="$ZSH_DIR/log" -mkdir -p "$LOG_DIR" - -HISTFILE="$ZSH_DIR/histfile" +ZSH_DIR="$XDG_CONFIG_HOME/zsh" +LOG_DIR="$XDG_DATA_HOME/logs" +HISTFILE="$XDG_DATA_HOME/zsh/history" HISTSIZE=999999 SAVEHIST=999999 +mkdir -p "$LOG_DIR" "$(dirname "$HISTFILE")" + exists() { which $@ 0<&- 1>/dev/null 2>/dev/null; } # Only set tty if running interactively @@ -62,8 +61,7 @@ x-bash-backward-kill-word(){ WORDCHARS='' zle kill-word; } zle -N x-bash-backward-kill-word # Load antigen & plugins -ADOTDIR="$ZSH_DIR/antigen" # Antigen directory -ANTIGEN_LOG="$LOG_DIR/antigen-$(date +"%Y_%m_%d_%I_%M_%p").log" +ANTIGEN_LOG="$LOG_DIR/antigen-$(date -u --iso-8601=seconds | cut -d+ -f1).log" antigen_src="$ADOTDIR/antigen.zsh" if [ ! -f "$antigen_src" ]; then git clone https://github.com/zsh-users/antigen.git "$ADOTDIR" diff --git a/.profile b/.profile index 669fa1e..0e3673f 100644 --- a/.profile +++ b/.profile @@ -21,6 +21,7 @@ export VISUAL="vim" # Override paths for non-compliant programs # https://wiki.archlinux.org/index.php/XDG_Base_Directory_support +export ADOTDIR="$XDG_DATA_HOME/zsh/antigen" export CARGO_HOME="$XDG_DATA_HOME/cargo" export GNUPGHOME="$XDG_CONFIG_HOME/gnupg" export GOPATH="$XDG_DATA_HOME/go"