-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
executable file
·54 lines (48 loc) · 1.4 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
42
43
44
45
46
47
48
49
50
51
52
53
# =============================================================================
# File : zshrc
# Author : yukimemi
# Last Change : 2024/07/06 20:40:21.
# =============================================================================
#
# pkgx
#
(( $+commands[pkgx] )) || curl -fsS https://pkgx.sh | sh
function command_not_found_handler() {
(( $+commands[$1] )) || pkgx install $1
pkgx -- $*
}
# source <(pkgx --shellcode)
#
# source command override technique
# https://zenn.dev/fuzmare/articles/zsh-plugin-manager-cache
#
function source {
ensure_zcompiled $1
builtin source $1
}
function ensure_zcompiled {
local compiled="$1.zwc"
if [[ ! -r "$compiled" || "$1" -nt "$compiled" ]]; then
echo "\033[1;36mCompiling\033[m $1"
zcompile $1
fi
}
ensure_zcompiled "$HOME/.zshrc"
#
# sheldon cache technique
#
export SHELDON_CONFIG_DIR="$HOME/.config/sheldon"
sheldon_cache="$SHELDON_CONFIG_DIR/sheldon.zsh"
sheldon_toml="$SHELDON_CONFIG_DIR/plugins.toml"
(( $+commands[sheldon] )) || curl --proto '=https' -fLsS https://rossmacarthur.github.io/install/crate.sh | bash -s -- --repo rossmacarthur/sheldon --to ~/.local/bin
if [[ ! -r "$sheldon_cache" || "$sheldon_toml" -nt "$sheldon_cache" ]]; then
sheldon source > $sheldon_cache
fi
source "$sheldon_cache"
unset sheldon_cache sheldon_toml
#
# tmux
#
[ -z "${TMUX}" ] && { tmux attach || tmux -u; }
# Release source
zsh-defer unfunction source