1
0
dotfiles/.config/zsh/lib/selfservice.zsh

53 lines
1.1 KiB
Bash
Raw Normal View History

2021-03-21 18:25:10 +03:00
#!/bin/zsh
dotfiles-update() {
"${ZSHU[d_zdot]}/.config/dotfiles/install.sh"
}
2021-03-21 22:14:40 +03:00
dotfiles-git() { (
cd "${ZSHU[d_zdot]}/"
export GIT_DIR="${ZSHU[d_zdot]}/.config/dotfiles/repo.git"
export GIT_WORK_TREE="${ZSHU[d_zdot]}"
zsh -i
) }
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() {
dotfiles-update
2024-02-23 21:46:04 +03:00
z-cache-flush
2021-03-21 18:25:10 +03:00
}
z-reload() {
exec -a "${ZSH_ARGZERO}" "${ZSH_NAME}" "${argv[@]}"
echo "unable to reload (something went wrong), code $?" 1>&2
2023-12-23 09:11:04 +03:00
return 1
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
2022-09-05 10:42:43 +03:00
z-zwc-flush
z-zwc-gen
2022-05-18 10:33:49 +03:00
}