-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.zshrc
144 lines (125 loc) Β· 4.71 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
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# ---------------------------------------------
# .zshrc
# ---------------------------------------------
# This file should be used to set up the paths for the shell. This file
# should not produce any output.
# PATH Glob Options
# (N-/).... do not register if the directory does not exists
# N........ NULL_GLOB option (ignore path if it does not match the glob)
# n........ sort the output
# [-1]..... select the last item in the array
# -........ follow the symbol links
# /........ ignore files
# Ensure path arrays do not contain duplicates.
typeset -gU cdpath fpath manpath path
# Syntax highlighting for the shell ZSH
typeset -ga ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
typeset -gA ZSH_HIGHLIGHT_STYLES
fpath=(
${ZDOTDIR:-$HOME}/functions/functions.zwc(N-)
${ZDOTDIR:-$HOME}/completions/completions.zwc(N-)
${ZDOTDIR:-$HOME}/functions(N-/)
${ZDOTDIR:-$HOME}/completions(N-/)
${ZDOTDIR:-$HOME}/prompt/prompt.zwc(N-)
${ZDOTDIR:-$HOME}/prompt/functions(N-/)
/opt/homebrew/share/zsh/site-functions(N-/)
${fpath}
)
() {
setopt EXTENDED_GLOB
autoload -Uz ${ZDOTDIR:-$HOME}/functions/^*.zwc*
autoload -Uz ${ZDOTDIR:-$HOME}/completions/^*.zwc*
}
# Get the original manpath, then modify it.
(( $+commands[manpath] )) && MANPATH="`manpath`"
manpath=(
${HOMEBREW_PREFIX:-/usr/local}/opt/*/libexec/gnuman(N-/)
"$manpath[@]"
)
infopath=(
/usr/local/share/info
$infopath
)
# Set the the list of directories that cd searches.
cdpath=(
$cdpath
)
# Set the list of directories that Zsh searches for programs.
path=(
./bin(N-/)
${HOME}/.zplug/bin(N-/)
${FORGIT_INSTALL_DIR}/bin
${ZDOTDIR:-$HOME}/bin(N-/)
${HOME}/.bin/local(N-/)
${HOME}/.bin(N-/)
${HOME}/.cargo/bin(N-/)
${HOME}/.volta/bin(N-/) # https://volta.sh
${GOPATH}/bin(N-/)
${HOMEBREW_PREFIX:-/opt/homebrew}/opt/coreutils/libexec/gnubin(N-/)
${HOMEBREW_PREFIX:-/opt/homebrew}/opt/python/libexec/bin(N-/)
${HOMEBREW_PREFIX:-/opt/homebrew}/opt/findutils/libexec/gnubin(N-/)
${HOMEBREW_PREFIX:-/opt/homebrew}/opt/curl/bin(N-/)
$HOME/Library/Python/3.*/bin(Nn[-1]-/)
${HOMEBREW_PREFIX:-/opt/homebrew}/{bin,sbin}(N-/)
$path
)
# ββββββββββββββββββ
# β Configurations β
# ββββββββββββββββββ
#
# The array is used to load the settings in the desired order
zconfig=(
zplug
completion
compdefs
environment
gpg
history
mappings
prompt
editor
aliases
fzf
direnv
)
for config (${ZDOTDIR:-$HOME}/config/${^zconfig}.zsh) source $config && unset config
# ββββββ
# β FZ β
# ββββββ
export FZ_HISTORY_CD_CMD="_zlua"
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# β Make sure git completions are the good ones β
# β For reference: https://github.com/github/hub/pull/1962 β
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
if [ "$(uname)" = "Darwin" ]; then
if [[ -d /opt/homebrew ]]; then
(
if [ -e /opt/homebrew/zsh/site-functions/_git ]; then
command mv -f /opt/homebrew/share/zsh/site-functions/{,disabled.}_git 2>/dev/null
command mv -f /opt/homebrew/share/zsh/site-functions/{,disabled.}git-completion.bash 2>/dev/null
fi
) &!
fi
if [[ -d /usr/local ]]; then
(
if [ -e /usr/local/share/zsh/site-functions/_git ]; then
command mv -f /usr/local/share/zsh/site-functions/{,disabled.}_git 2>/dev/null
command mv -f /usr/local/share/zsh/site-functions/{,disabled.}git-completion.bash 2>/dev/null
fi
) &!
fi
fi
# ββββββββββββββββββββββ
# β Load local configs β
# ββββββββββββββββββββββ
if [[ -f ${HOME}/.zshrc.local ]]; then
source $HOME/.zshrc.local
else
[[ -z "${HOMEBREW_GITHUB_API_TOKEN}" ]] && echo "β HOMEBREW_GITHUB_API_TOKEN not set." && _has_unset_config=yes
[[ -z "${GITHUB_TOKEN}" ]] && echo "β GITHUB_TOKEN not set." && _has_unset_config=yes
[[ -z "${NPM_REGISTRY_TOKEN}" ]] && echo "β NPM_REGISTRY_TOKEN not set." && _has_unset_config=yes
[[ -z "${GITHUB_REGISTRY_TOKEN}" ]] && echo "β GITHUB_REGISTRY_TOKEN not set." && _has_unset_config=yes
[[ -z "${GH_PASS}" ]] && echo "β GH_PASS not set." && _has_unset_config=yes
[[ ${_has_unset_config:-no} == "yes" ]] && echo "Set the missing configs in ~/.zshrc"
fi
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh