-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
125 lines (103 loc) · 3.44 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
# profile startup
zmodload zsh/zprof
# add the argument to $PATH only if it's not already present
function extend_path() {
[[ ":$PATH:" != *":$1:"* ]] && export PATH="$1:$PATH"
}
# add ~/bin and ~/.local/bin to $PATH if they exist
extend_path "$HOME/bin"
extend_path "$HOME/.local/bin"
# brew installs some binaries like openvpn to /usr/local/sbin
[[ $OSTYPE == darwin* ]] && extend_path "/usr/local/sbin"
if type brew &> /dev/null; then
# Enable brew installed completions
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
fi
# zgen
if [[ ! -d $HOME/.zgen ]]; then
echo "predicate triggered"
git clone https://github.com/tarjoilija/zgen.git "$HOME/.zgen"
fi
export ZGEN_RESET_ON_CHANGE=($HOME/.zshrc)
export ZGEN_PLUGIN_UPDATE_DAYS=15
export ZGEN_SYSTEM_UPDATE_DAYS=15
export NVM_LAZY_LOAD=true
source "$HOME/.zgen/zgen.zsh"
if ! zgen saved; then
# plugins
zgen load docker/cli contrib/completion/zsh
zgen load lukechilds/zsh-nvm
zgen load peterhurford/git-it-on.zsh
zgen load rupa/z
zgen load unixorn/autoupdate-zgen
zgen load zsh-users/zsh-completions
zgen load zsh-users/zsh-history-substring-search
zgen load zsh-users/zsh-syntax-highlighting
# prezto config
zgen prezto
zgen prezto environment
zgen prezto terminal
zgen prezto editor
zgen prezto history
zgen prezto directory
zgen prezto helper
zgen prezto spectrum
zgen prezto utility
zgen prezto completion
# zgen prezto prompt
zgen prezto syntax-highlighting
# zgen prezto git
zgen prezto editor key-bindings 'vi'
zgen prezto '*:*' case-sensitive 'no'
zgen prezto '*:*' color 'yes'
zgen prezto 'module:editor' dot-expansion 'no'
zgen prezto 'module:editor' key-bindings 'vi'
zgen prezto 'module:syntax-highlighting' highlighters 'main' 'brackets' 'pattern' 'cursor'
zgen prezto 'module:terminal' auto-title 'yes'
# zgen prezto prompt theme 'pure'
zgen save
fi
# disable ctrl+d EOF
setopt ignoreeof
# prefer neovim as the default editor
if which nvim > /dev/null; then
export EDITOR=nvim
alias vi=nvim
alias vim=nvim
else
export EDITOR=vim
alias nvim=vim
fi
export GIT_EDITOR=$EDITOR
export VISUAL=$EDITOR
# add GoLand to the path if it exists
extend_path "/Applications/GoLand.app/Contents/MacOS"
# prefer GNU sed b/c BSD sed doesn't handle whitespace the same
if which gsed > /dev/null; then extend_path "/usr/local/opt/gnu-sed/libexec/gnubin"; fi
# rust (b/c rustup doesn't play well with the rust brew formulae)
if ! which rustup > /dev/null; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
fi
# set GOBIN
export GOBIN="$(go env GOPATH)/bin"
extend_path "$(go env GOBIN)"
# kubernetes
if which kubectl > /dev/null; then
alias k=kubectl
export KUBECONFIG="$HOME/.kube/config"
fi
# add mysql-client to the path if it exists
extend_path "/usr/local/opt/mysql-client/bin"
# enable direnv (directory-specific environment variables)
eval "$(direnv hook zsh)"
# enable starship (prompt styling)
eval "$(starship init zsh)"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/nick/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/nick/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/nick/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/nick/google-cloud-sdk/completion.zsh.inc'; fi
# Enable completion
autoload -Uz compinit
compinit
# Add Homebrew's zsh completion directory to fpath
fpath=($fpath /opt/homebrew/share/zsh/site-functions)