-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
41 lines (35 loc) · 1.13 KB
/
.zshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
## Author: druckdev
## Created: 2018-11-23
# Enable Powerlevel10k instant prompt. Should stay close to the top.
# 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 "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# https://github.com/romkatv/dotfiles-public/blob/7e49fc4fb71d/.zshrc#L35
comp-conf() {
emulate -L zsh
[[ ! "$1.zwc" -nt "$1" && -w "${1:h}" ]] || return 0
zmodload -F zsh/files b:zf_mv b:zf_rm
local tmp="$1.tmp.$$.zwc"
{
zcompile -R -- "$tmp" "$1" && zf_mv -f -- "$tmp" "$1.zwc" || return 1
} always {
(( ! $? )) || zf_rm -f -- "$tmp"
}
}
# https://github.com/romkatv/dotfiles-public/blob/7e49fc4fb71d/.zshrc#L47
comp-source() {
[[ -e "$1" ]] && comp-conf "$1" && source -- "$1"
}
folder-source() {
[[ -d "$1" ]] || return 1
for f in "$1"/[^._]*(N); do
if [[ -d "$f" ]]; then
folder-source "$f"
elif [[ $f =~ .zsh$ ]]; then
comp-source "$f"
fi
done
}
folder-source "$ZDOTDIR"/zshrc.d