-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc
191 lines (156 loc) · 5.14 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# modify the prompt to contain git branch name if applicable
get_pwd() {
echo "${PWD/$HOME/~}"
}
parse_git_dirty() {
local STATUS=''
STATUS=$(command git status --porcelain 2> /dev/null | tail -n1)
if [[ -n $STATUS ]]; then
echo "%F{red}✗"
else
echo "%F{green}✔"
fi
}
current_branch() {
local ref
ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null)
local ret=$?
if [[ $ret != 0 ]]; then
[[ $ret == 128 ]] && return # no git repo.
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
fi
echo ${ref#refs/heads/}
}
git_prompt_info() {
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
echo "$(parse_git_dirty) [git:$(current_branch)]"
}
setopt promptsubst
export PS1='
%F{cyan}%m: %F{yellow}$(get_pwd) $(git_prompt_info)
%F{blue}→ %f '
# completion
autoload -U compinit
compinit
# load our own completion functions
for completion in ~/.zsh/completions/*; do
source $completion
done
# load custom executable functions
for function in ~/.zsh/functions/*; do
source $function
done
# makes color constants available
autoload -U colors
colors
# enable colored output from ls, etc
export CLICOLOR=1
# history settings
setopt inc_append_history
setopt hist_ignore_space
setopt hist_ignore_all_dups
setopt hist_verify
setopt append_history
setopt extended_history
setopt share_history
HISTFILE=~/.zhistory
HISTSIZE=10000
SAVEHIST=10000
# awesome cd movements from zshkit
setopt autocd autopushd pushdminus pushdsilent pushdtohome cdablevars
DIRSTACKSIZE=5
# Enable extended globbing
setopt extendedglob
# Allow [ or ] whereever you want
unsetopt nomatch
# Allow case insensitive tab completion
setopt +o menucomplete
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
# vi mode
bindkey -v
bindkey "^F" vi-cmd-mode
bindkey jj vi-cmd-mode
# handy keybindings
bindkey "^A" beginning-of-line
bindkey "^E" end-of-line
bindkey "^K" kill-line
zle -N fh
bindkey "^R" fh
bindkey "^P" history-search-backward
bindkey "^Y" accept-and-hold
bindkey "^N" insert-last-word
bindkey -s "^T" "^[Isudo ^[A" # "t" for "toughguy"
# aliases
[[ -f ~/.aliases ]] && source ~/.aliases
# extra files in ~/.zsh/configs/pre , ~/.zsh/configs , and ~/.zsh/configs/post
# these are loaded first, second, and third, respectively.
_load_settings() {
_dir="$1"
if [ -d "$_dir" ]; then
if [ -d "$_dir/pre" ]; then
for config in "$_dir"/pre/**/*(N-.); do
. $config
done
fi
for config in "$_dir"/**/*(N-.); do
case "$config" in
"$_dir"/pre/*)
:
;;
"$_dir"/post/*)
:
;;
*)
if [ -f $config ]; then
. $config
fi
;;
esac
done
if [ -d "$_dir/post" ]; then
for config in "$_dir"/post/**/*(N-.); do
. $config
done
fi
fi
}
_load_settings "$HOME/.zsh/configs"
# Local config
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local
# Setting ag as the default source for fzf
export FZF_DEFAULT_COMMAND='ag -g ""'
EDITOR=vi
PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
export PATH="$HOME/.fastlane/bin:$PATH"
export PATH="$HOME/.bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
export PATH="/usr/local/opt/python/libexec/bin:$PATH"
export PATH="$HOME/Library/Python/3.6/bin:$PATH"
export PATH="$HOME/.esp/xtensa-esp32-elf/bin:$PATH"
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
export IDF_PATH="$HOME/.esp/esp-idf"
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
eval "$(rbenv init - --no-rehash zsh)"
GPG_TTY=$(tty)
export GPG_TTY
# tabtab source for serverless package
# uninstall by removing these lines or running `tabtab uninstall serverless`
[[ -f /Users/tony/.config/yarn/global/node_modules/tabtab/.completions/serverless.zsh ]] && . /Users/tony/.config/yarn/global/node_modules/tabtab/.completions/serverless.zsh
# tabtab source for sls package
# uninstall by removing these lines or running `tabtab uninstall sls`
[[ -f /Users/tony/.config/yarn/global/node_modules/tabtab/.completions/sls.zsh ]] && . /Users/tony/.config/yarn/global/node_modules/tabtab/.completions/sls.zsh
eval "$(direnv hook bash)"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/tony/dev/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/tony/dev/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/tony/dev/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/tony/dev/google-cloud-sdk/completion.zsh.inc'; fi
# tabtab source for packages
# uninstall by removing these lines
[[ -f ~/.config/tabtab/__tabtab.zsh ]] && . ~/.config/tabtab/__tabtab.zsh || true
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"