2021-03-21 18:25:10 +03:00
|
|
|
#!/bin/zsh
|
|
|
|
|
|
|
|
dotfiles-update() {
|
2024-07-05 17:51:22 +03:00
|
|
|
"${ZSHU[d_dotfiles]}/install.sh" "$@" || return $?
|
2021-03-21 18:25:10 +03:00
|
|
|
}
|
|
|
|
|
2021-03-21 22:14:40 +03:00
|
|
|
dotfiles-git() { (
|
|
|
|
cd "${ZSHU[d_zdot]}/"
|
2024-02-28 23:22:33 +03:00
|
|
|
set -a
|
|
|
|
GIT_DIR="${ZSHU[d_dotfiles]}/repo.git"
|
|
|
|
GIT_WORK_TREE="${ZSHU[d_zdot]}"
|
|
|
|
set +a
|
2024-02-29 00:15:08 +03:00
|
|
|
z-reload
|
2021-03-21 22:14:40 +03:00
|
|
|
) }
|
|
|
|
|
2024-02-28 23:22:33 +03:00
|
|
|
dotfiles-gen-gitignore() {
|
|
|
|
local x='.config/dotfiles/gen-gitignore.sh'
|
|
|
|
[ -x "$x" ] || {
|
|
|
|
echo "${x:t} is somewhere else" >&2
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
if [ -d .config/dotfiles/repo.git ] ; then
|
|
|
|
echo "NOT going to change dotfiles installation" >&2
|
2024-03-04 15:35:55 +03:00
|
|
|
return 2
|
2024-02-28 23:22:33 +03:00
|
|
|
fi
|
|
|
|
"$x" "$@"
|
|
|
|
}
|
|
|
|
|
2022-09-05 10:42:43 +03:00
|
|
|
z-zwc-gen() {
|
|
|
|
local i
|
2022-09-05 11:11:57 +03:00
|
|
|
for i ( "${ZSHU[d_conf]}"/**/*.zsh(N.r) ) ; do
|
2024-02-20 09:51:55 +03:00
|
|
|
zcompile -UR "$i"
|
|
|
|
done
|
2024-02-23 21:46:04 +03:00
|
|
|
# for i ( "${ZSHU[d_completion]}"/*(N.r) ) ; do
|
|
|
|
# case "$i" in
|
|
|
|
# *.zwc )
|
|
|
|
# # likely a remnant
|
|
|
|
# rm -f "$i"
|
|
|
|
# continue
|
|
|
|
# ;;
|
|
|
|
# esac
|
|
|
|
# zcompile -UR "$i"
|
|
|
|
# mv -f "$i.zwc" "${ZSHU[d_compzwc]}/"
|
|
|
|
# done
|
2022-09-05 10:42:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
z-zwc-flush() {
|
2022-09-05 11:11:57 +03:00
|
|
|
rm -f "${ZSHU[d_conf]}"/**/*.zwc(N.r)
|
2022-09-05 10:42:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
z-update() {
|
2024-07-05 17:51:22 +03:00
|
|
|
dotfiles-update || return $?
|
2024-02-23 21:46:04 +03:00
|
|
|
z-cache-flush
|
2021-03-21 18:25:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
z-reload() {
|
2024-02-29 00:15:08 +03:00
|
|
|
export ZDOTDIR="${ZSHU[d_zdot]}"
|
2024-03-04 15:35:55 +03:00
|
|
|
local r
|
2021-03-21 18:25:10 +03:00
|
|
|
exec -a "${ZSH_ARGZERO}" "${ZSH_NAME}" "${argv[@]}"
|
2024-03-04 15:35:55 +03:00
|
|
|
r=$?
|
|
|
|
echo "unable to reload (something went wrong), code $r" >&2
|
|
|
|
return $r
|
2021-03-21 18:25:10 +03:00
|
|
|
}
|
2022-05-18 10:33:49 +03:00
|
|
|
|
|
|
|
## reload or new session are required to regenerate compcache
|
|
|
|
z-cache-flush() {
|
2024-02-23 21:46:04 +03:00
|
|
|
find "${ZSHU[d_cache]}/" -xdev -type f '!' -name '.keep' -delete
|
2024-02-29 01:04:53 +03:00
|
|
|
find "${ZSHU[d_zdot]}/.config/zsh.dots/" -xdev -type f '!' -name '.zshenv' -delete
|
2022-09-05 10:42:43 +03:00
|
|
|
z-zwc-flush
|
|
|
|
z-zwc-gen
|
2022-05-18 10:33:49 +03:00
|
|
|
}
|