1
0

zsh: rework ZDOTDIR redirection
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Konstantin Demin 2024-02-29 01:04:53 +03:00
parent 7aac214e04
commit 3321d21f8b
Signed by: krd
GPG Key ID: 1F33CB0BA4731BC6
6 changed files with 9 additions and 3 deletions

View File

View File

@ -2,7 +2,6 @@
!/.cache/zsh/compcache/.keep
!/.cache/zsh/completion/.keep
!/.cache/zsh/compzwc/.keep
!/.cache/zsh/dots/.keep
!/.config/dotfiles/bin/.keep
!/.config/dotfiles/gen-gitignore.sh
!/.config/dotfiles/gitattributes
@ -12,6 +11,7 @@
!/.config/dotfiles/woodpecker.yml
!/.config/htop/htoprc.dist
!/.config/mc/ini.dist
!/.config/zsh.dots/.zshenv
!/.config/zsh/_.zsh
!/.config/zsh/_wip/enclave.zsh.wip
!/.config/zsh/_wip/starship.zsh.sample

6
.config/zsh.dots/.zshenv Normal file
View File

@ -0,0 +1,6 @@
#!/bin/zsh
if [[ -o interactive ]] ; then
## early redirect
ZDOTDIR="${ZDOTDIR%/${ZDOTDIR:t2}}"
source "${ZDOTDIR}/.zshenv"
fi

View File

@ -18,7 +18,7 @@ unsetopt global_rcs
## safety measure:
## redirect all following activity within ZDOTDIR to cache
export ZDOTDIR="${ZSHU[d_cache]}/dots"
export ZDOTDIR="${ZDOTDIR}/.config/zsh.dots"
## cleanup: start from scratch
for i ( a s f d ) ; do unhash -$i -m '*' ; done ; unset i

View File

@ -63,6 +63,7 @@ z-reload() {
## reload or new session are required to regenerate compcache
z-cache-flush() {
find "${ZSHU[d_cache]}/" -xdev -type f '!' -name '.keep' -delete
find "${ZSHU[d_zdot]}/.config/zsh.dots/" -xdev -type f '!' -name '.zshenv' -delete
z-zwc-flush
z-zwc-gen
}

View File

@ -2,6 +2,5 @@
if [[ -o interactive ]] ; then
## early redirect
: "${ZDOTDIR:=${HOME}}"
[ "${ZDOTDIR}" = "${HOME}/.cache/zsh/dots" ] && ZDOTDIR="${HOME}"
source "${ZDOTDIR}/.config/zsh/_.zsh"
fi