1
0
Fork 0
chezmoi/dot_config/zsh/init.zsh
2022-12-01 01:56:37 +01:00

32 lines
1 KiB
Bash

cachedir=${XDG_CACHE_HOME:-$HOME/.cache}/zsh
datadir=${XDG_DATA_HOME:-$HOME/.local/share}/zsh
confdir=$(dirname $(print -P %N))
test -d $cachedir || mkdir -p $cachedir
test -d $datadir || mkdir -p $datadir
# Enable Powerlevel10k instant prompt. Should stay close to the top of ${ZDOTDIR:-${HOME}}/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${cachedir}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${cachedir}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
ZIM_HOME=$datadir/zim
test -d $ZIM_HOME || mkdir -p $ZIM_HOME
if [[ ! -e ${ZIM_HOME}/zimfw.zsh ]]; then
wget -O ${ZIM_HOME}/zimfw.zsh \
https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
fi
for cf in ~/.config/zsh/include/*.zsh ; do
source $cf
done
if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
source ${ZIM_HOME}/zimfw.zsh init -v
fi
source ${ZIM_HOME}/init.zsh
unset cachedir datadir confdir