Add XDG Base Directory vars, refactor env var names and defs
This commit is contained in:
		@@ -1,9 +1,16 @@
 | 
			
		||||
#!/bin/zsh
 | 
			
		||||
 | 
			
		||||
[[ ! -d $HOME/.config ]] && mkdir $HOME/.config
 | 
			
		||||
# source file where vars are defined
 | 
			
		||||
source ./src_files/.config/zsh/.zshenv
 | 
			
		||||
 | 
			
		||||
[[ ! -d $HOME/.local ]] && mkdir $HOME/.local
 | 
			
		||||
[[ ! -d $HOME/.local/bin ]] && mkdir $HOME/.local/bin
 | 
			
		||||
[[ ! -d $HOME/.local/build ]] && mkdir $HOME/.local/build
 | 
			
		||||
[[ ! -d $HOME/.local/scripts ]] && mkdir $HOME/.local/scripts
 | 
			
		||||
[[ ! -d $HOME/.local/tmp ]] && mkdir $HOME/.local/tmp
 | 
			
		||||
# any dirs made here should be defined in the file sourced above
 | 
			
		||||
[[ ! -d "$DIR_LOCAL" ]] && mkdir "$DIR_LOCAL"
 | 
			
		||||
[[ ! -d "$DIR_BIN" ]] && mkdir "$DIR_BIN"
 | 
			
		||||
[[ ! -d "$DIR_BUILD" ]] && mkdir "$DIR_BUILD"
 | 
			
		||||
[[ ! -d "$DIR_SCRIPTS" ]] && mkdir "$DIR_SCRIPTS"
 | 
			
		||||
[[ ! -d "$DIR_TMP" ]] && mkdir "$DIR_TMP"
 | 
			
		||||
 | 
			
		||||
[[ ! -d "$XDG_CONFIG_HOME" ]] && mkdir "$XDG_CONFIG_HOME"
 | 
			
		||||
[[ ! -d "$XDG_CACHE_HOME" ]] && mkdir "$XDG_CACHE_HOME"
 | 
			
		||||
[[ ! -d "$XDG_DATA_HOME" ]] && mkdir "$XDG_DATA_HOME"
 | 
			
		||||
[[ ! -d "$XDG_STATE_HOME" ]] && mkdir "$XDG_STATE_HOME"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
#!/bin/zsh
 | 
			
		||||
 | 
			
		||||
[[ ! -d "$HOME_BOX" ]] && mkdir $HOME_BOX
 | 
			
		||||
[[ ! -d "$DIR_HOME_BOX" ]] && mkdir $DIR_HOME_BOX
 | 
			
		||||
 | 
			
		||||
[[ ! -d "$DIR_DEV" ]] && mkdir $DIR_DEV
 | 
			
		||||
[[ ! -d "$DIR_DEV/git" ]] && mkdir $DIR_DEV/git
 | 
			
		||||
 
 | 
			
		||||
@@ -16,8 +16,8 @@ alias git-push-to-develop='git branch -D develop; git checkout -b develop; git p
 | 
			
		||||
alias gpdev='git-push-to-develop'
 | 
			
		||||
 | 
			
		||||
# misc shortcuts
 | 
			
		||||
alias journal="cd $HOME_BOX; $EDITOR .current-journal"
 | 
			
		||||
alias kra="cd $HOME_BOX/process/kra; open .current_kra"
 | 
			
		||||
alias journal="cd $DIR_HOME_BOX; $EDITOR .current-journal"
 | 
			
		||||
alias kra="cd $DIR_HOME_BOX/process/kra; open .current_kra"
 | 
			
		||||
alias gll="cd $DIR_DEV/git/lampo/gitlab"
 | 
			
		||||
alias bet='bundle exec rspec'
 | 
			
		||||
alias bel='bundle exec standardrb'
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
# life system shortcuts
 | 
			
		||||
alias life-system="cd $HOME_BOX/life/system; clear; ls"
 | 
			
		||||
alias goals="clear; sed -n 2,7p $HOME_BOX/life/system/direction/goals/current-goals.txt"
 | 
			
		||||
alias note="cd $HOME_BOX/life/system/tasks/inbox; $EDITOR"
 | 
			
		||||
alias todo="cd $HOME_BOX/life/system/tasks; $EDITOR +5 todo.txt"
 | 
			
		||||
alias budget="open $HOME_BOX/life/finance/budget/.current"
 | 
			
		||||
alias life-system="cd $DIR_HOME_BOX/life/system; clear; ls"
 | 
			
		||||
alias goals="clear; sed -n 2,7p $DIR_HOME_BOX/life/system/direction/goals/current-goals.txt"
 | 
			
		||||
alias note="cd $DIR_HOME_BOX/life/system/tasks/inbox; $EDITOR"
 | 
			
		||||
alias todo="cd $DIR_HOME_BOX/life/system/tasks; $EDITOR +5 todo.txt"
 | 
			
		||||
alias budget="open $DIR_HOME_BOX/life/finance/budget/.current"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,19 +1,31 @@
 | 
			
		||||
# common/system env vars
 | 
			
		||||
# default programs
 | 
			
		||||
export EDITOR='vim' # TODO: update to nvim once configured
 | 
			
		||||
 | 
			
		||||
# env vars used for my organization structure
 | 
			
		||||
export HOME_BOX="$HOME/dbox"
 | 
			
		||||
export DIR_HOME_BOX="$HOME/dbox"
 | 
			
		||||
export DIR_DEV="$HOME/dev"
 | 
			
		||||
 | 
			
		||||
# general targets for config/builds/etc
 | 
			
		||||
export DIR_CONFIG="$HOME/.config"
 | 
			
		||||
export XDG_CONFIG_HOME=$DIR_CONFIG
 | 
			
		||||
# util dirs; do not change without checking impact on xdg base dirs
 | 
			
		||||
export DIR_LOCAL="$HOME/.local"
 | 
			
		||||
export DIR_BIN="$DIR_LOCAL/bin"
 | 
			
		||||
export DIR_BUILD="$DIR_LOCAL/build"
 | 
			
		||||
export DIR_SCRIPTS="$DIR_LOCAL/scripts"
 | 
			
		||||
export DIR_TMP="$DIR_LOCAL/tmp"
 | 
			
		||||
 | 
			
		||||
# xdg base directory vars
 | 
			
		||||
export XDG_CONFIG_HOME="$HOME/.config"
 | 
			
		||||
export XDG_CACHE_HOME="$HOME/.cache"
 | 
			
		||||
export XDG_DATA_HOME="$DIR_LOCAL/share"
 | 
			
		||||
export XDG_STATE_HOME="$DIR_LOCAL/state"
 | 
			
		||||
export XDG_DATA_DIRS="/usr/local/share:/usr/share"
 | 
			
		||||
#export XDG_CONFIG_DIRS="/etc/xdg" # TODO: does this work on macos?
 | 
			
		||||
 | 
			
		||||
# zsh
 | 
			
		||||
export ZDOTDIR="$DIR_CONFIG/zsh" # may already be set, set anyway
 | 
			
		||||
export ZDOTDIR="$XDG_CONFIG_HOME/zsh" # may already be set, set anyway
 | 
			
		||||
 | 
			
		||||
# git
 | 
			
		||||
export GIT_EDITOR="$EDITOR"
 | 
			
		||||
 | 
			
		||||
# clean-up of home dir
 | 
			
		||||
export __CF_USER_TEXT_ENCODING="0x0:0x0"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
set -o vi
 | 
			
		||||
 | 
			
		||||
# path updates
 | 
			
		||||
export PATH=$DIR_LOCAL/bin:$DIR_LOCAL/scripts:$PATH
 | 
			
		||||
export PATH=$DIR_BIN:$DIR_SCRIPTS:$PATH
 | 
			
		||||
export PATH=$PATH:/opt/homebrew/opt/ccache/libexec
 | 
			
		||||
export PATH=$PATH:~/bin/android-sdk-darwin/platform-tools:/opt/homebrew/opt/ccache/libexec
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
local omitted_dirs=(
 | 
			
		||||
    $HOME
 | 
			
		||||
    $HOME_BOX
 | 
			
		||||
    $DIR_HOME_BOX
 | 
			
		||||
    $DIR_DEV
 | 
			
		||||
    $DIR_DEV/git
 | 
			
		||||
)
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@ hydrate() {
 | 
			
		||||
local name_regex="^\([-_A-Za-z0-9]*\):.*$"
 | 
			
		||||
local existing_sessions=$([[ -n $(pgrep tmux) ]] && tmux list-sessions | sed "s/$name_regex/\1/" || echo '')
 | 
			
		||||
local search_dirs=(
 | 
			
		||||
    $HOME_BOX
 | 
			
		||||
    $DIR_HOME_BOX
 | 
			
		||||
    $DIR_DEV
 | 
			
		||||
    $DIR_DEV/git/*
 | 
			
		||||
)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user