config/zsh: improve environment variable setting

This commit is contained in:
xeruf 2022-10-13 21:55:31 +02:00
parent b5e3ba2784
commit 8949048286
2 changed files with 14 additions and 4 deletions

View File

@ -156,6 +156,7 @@ setopt hist_find_no_dups
setopt hist_save_no_dups setopt hist_save_no_dups
setopt hist_reduce_blanks setopt hist_reduce_blanks
unsetopt hist_ignore_space unsetopt hist_ignore_space
# TODO filter from history: netkeeper killm
setopt extended_glob setopt extended_glob
unsetopt case_glob unsetopt case_glob

17
.zshenv
View File

@ -1,4 +1,12 @@
export DATA="$(test -d $HOME/daten && echo $HOME/daten || echo $HOME/data)" export_existing() {
local var=$1
while test $# -gt 0
do test -d "$2" && export $var="$2" && break
shift
done
echo
}
export_existing DATA $HOME/daten $HOME/data
export MUSIC="$DATA/4-media/music" export MUSIC="$DATA/4-media/music"
export BORG_REPO='/mnt/backup/borg' export BORG_REPO='/mnt/backup/borg'
@ -12,9 +20,8 @@ export XDG_CONFIG_HOME="$HOME/.config"
export JOURNAL="$(eval "dirname $(grep -1 journals $XDG_CONFIG_HOME/jrnl/jrnl.yaml | tail -1 | cut -d':' -f2-)" || export JOURNAL="$(eval "dirname $(grep -1 journals $XDG_CONFIG_HOME/jrnl/jrnl.yaml | tail -1 | cut -d':' -f2-)" ||
echo "$DATA/2-box/journal")" echo "$DATA/2-box/journal")"
export INSTALEE_HOME="$DATA/1-projects/1-personal/instalee" export_existing INSTALEE_HOME "$HOME/projects/instalee" "$DATA/1-projects/1-personal/instalee"
test -d "/mnt/data/projects/vosk/models" && export_existing VOSK_MODELS "/mnt/data/projects/vosk/models"
export VOSK_MODELS="/mnt/data/projects/vosk/models"
# adjust programs to use xdg # adjust programs to use xdg
export MNT=/run/media/$USER export MNT=/run/media/$USER
export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority
@ -53,6 +60,8 @@ export KSCRIPT_CACHE_DIR="$XDG_CACHE_HOME"/kscript
export RBENV_ROOT="$XDG_STATE_HOME"/rbenv export RBENV_ROOT="$XDG_STATE_HOME"/rbenv
export R_LIBS="$XDG_STATE_HOME"/R/lib
# Java & Android # Java & Android
export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME/java" export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME/java"
export GRADLE_USER_HOME="$XDG_STATE_HOME"/gradle export GRADLE_USER_HOME="$XDG_STATE_HOME"/gradle