-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_zshrc
119 lines (99 loc) · 3.08 KB
/
dot_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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# vim:foldmethod=marker:foldlevel=1
# Enable Powerlevel10k instant prompt. Only initialization code that may
# require console input should go above this block.
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
# Homebrew {{{
# Configure Homebrew before the rest of the configuration to ensure that
# all brew-installed utilities are available.
# Opt out of Homebrew analytics.
export HOMEBREW_NO_ANALYTICS=1
# Only run autoupdate once a day.
export HOMEBREW_AUTOUPDATE_SECS=86400
# Use `bat` for the `brew cat` command.
export HOMEBREW_BAT=1
# Disable additional hints about environment config.
export HOMEBREW_NO_ENV_HINTS=1
# Initialize Homebrew depending on Intel or Apple Silicon.
if command -v /opt/homebrew/bin/brew > /dev/null; then
eval "$(/opt/homebrew/bin/brew shellenv)"
else
eval "$(/usr/local/bin/brew shellenv)"
fi
# Make sure Homebrew-installed completions are on the FPATH.
fpath+="${HOMEBREW_PREFIX}/share/zsh/site-functions"
# }}}
## Install plugins
source ~/.zsh/plugins.zsh
_evalcache() {
local cache_dir="$HOME/.cache/zsh/init"
local cache_filename="$1"
shift
local cacheFile="${cache_dir}/${cache_filename}.zsh"
if [[ -s "$cacheFile" ]]; then
source "$cacheFile"
else
if command -v "$1" > /dev/null; then
mkdir -p "$cache_dir"
"$@" > "$cacheFile"
source "$cacheFile"
fi
fi
}
evalcache_clear() {
rm -i "$HOME/.cache/zsh/init/*.zsh"
}
# autoload custom executable functions
if [[ -d "$HOME/.zsh/functions" ]]; then
fpath+="$HOME/.zsh/functions"
autoload -Uz $HOME/.zsh/functions/*(.:t)
fi
# extra files in ~/.zsh/configs/pre , ~/.zsh/configs , and ~/.zsh/configs/post
# these are loaded first, second, and third, respectively.
_load_settings() {
setopt localoptions extendedglob
_dir="$1"
if [[ -d "$_dir" ]]; then
if [[ -d "$_dir/pre" ]]; then
for config in "$_dir"/pre/**/*~*.zwc(N-.); do
. $config
done
fi
for config in "$_dir"/**/*(N-.); do
case "$config" in
"$_dir"/(pre|post)/*|*.zwc)
:
;;
*)
. $config
;;
esac
done
if [[ -d "$_dir/post" ]]; then
for config in "$_dir"/post/**/*~*.zwc(N-.); do
. $config
done
fi
fi
}
_load_settings "$HOME/.zsh/configs"
unset -f _load_settings
# i smart case search ala Vim
# R color
# F exit if there is less than one page of content
# X keep content on screen after exit
# M show more info at the bottom prompt line
# x4 tabs are 4 instead of 8
export LESS=-iRFXMx4
export PAGER=less
export ACK_PAGER=less
[[ -r ~/.rgrc ]] && export RIPGREP_CONFIG_PATH=~/.rgrc
# Local config
[[ ! -f ~/.zshrc.local ]] || source ~/.zshrc.local
# aliases
[[ ! -f ~/.aliases ]] || source ~/.aliases
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
#########################################################################
##### Anything below this line was appended by an automated script! #####