-
Notifications
You must be signed in to change notification settings - Fork 1
/
.zshrc
executable file
·177 lines (152 loc) · 4.94 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
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
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
# profile zshrc from https://gist.github.com/mwilliammyers/54edf992399e794f7ffe
# uncomment head and tail when in need
# PROFILE_STARTUP=true
# if [[ "$PROFILE_STARTUP" == true ]]; then
# zmodload zsh/zprof # Output load-time statistics
# # http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html
# PS4=$'%D{%M%S%.} %N:%i> '
# exec 3>&2 2>"${XDG_CACHE_HOME:-$HOME/tmp}/zsh_statup.$$"
# setopt xtrace prompt_subst
# fi
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export DISABLE_AUTO_UPDATE="true"
export HOMEBREW_NO_AUTO_UPDATE=1
export ZSH=$HOME/.oh-my-zsh
export GOPATH=$HOME/gocode
export PATH="/opt/homebrew/bin:/opt/homebrew/opt/coreutils/libexec/gnubin:$GOPATH/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:$HOME/.virtualenvs/lain-cli/bin:/Users/timfeirg/.asdf/shims"
plugins=(
git
gitfast
asdf
git-extras
gpg-agent
vagrant
# golang
fasd
dotenv
redis-cli
ssh-agent
# mosh
docker
pip
virtualenv
virtualenvwrapper
# pyenv
kubectl
)
source $ZSH/oh-my-zsh.sh
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
source ~/antigen.zsh
source ~/.lain-complete.zsh
export ZLE_RPROMPT_INDENT=0
export ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
export ZSH_AUTOSUGGEST_USE_ASYNC=1
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-autosuggestions
# smartcase behavior in tab completions, see https://www.reddit.com/r/zsh/comments/4aq8ja/is_it_possible_to_enable_smartcase_tab_completion/
zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]}'
antigen bundle zsh-users/zsh-completions
antigen theme romkatv/powerlevel10k
antigen apply
COMPLETION_WAITING_DOTS="true"
# User configuration
DEFAULT_USER=timfeirg
DEBIAN_PREVENT_KEYBOARD_CHANGES=yes
export EDITOR=nvim
alias agq='ag -Q'
# export MANPAGER="nvim -c 'set ft=man' -"
alias sudo='sudo '
alias ktp='kubectl top pod'
alias kgp='kubectl get pod -owide'
# ansible related
alias ave="ansible-vault edit"
alias feature='git-feature'
alias bug='git-feature -a bug'
alias gsf='git-sync --force'
alias refactor='git-feature -a refactor'
alias gdb='git-delete-branch'
# edit all files that match this ag search
function agvi() {
ag $@ -l | xargs -o nvim
}
function hag() {
helm list --all | ag $@
}
function hdag() {
helm list --all | ag $@ | awk '{print $1}' | xargs helm delete
}
function kdag() {
kubectl get deploy | ag $@ | awk '{print $1}' | xargs kubectl scale --replicas=0 deployment
}
function gpswca() {
local repo_name=$(basename `git rev-parse --show-toplevel`)
git remote remove swca || true
git fetch --all --tags --prune && git delete-merged-branches
git remote add swca https://swca.aisino.com/aisino-ein-aics/$repo_name
git push -f swca --all
git push -f swca --tags
}
# vi mode
bindkey -v
bindkey '^h' backward-delete-char
bindkey '^w' backward-kill-word
bindkey '^[[Z' reverse-menu-complete
bindkey '^[[[CE' autosuggest-execute
bindkey '^E' end-of-line
bindkey '^A' beginning-of-line
export KEYTIMEOUT=1
# history config
HISTSIZE=100000
SAVEHIST=10000000
setopt menu_complete
setopt BANG_HIST
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_FIND_NO_DUPS
setopt HIST_SAVE_NO_DUPS
setopt HIST_REDUCE_BLANKS
autoload -U compinit
compinit
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
setopt correctall
autoload -U promptinit
promptinit
alias gs='TERM=xterm tig status'
alias gst='git branch --all && grv && git status --show-stash && git rev-list --format=%B --max-count=1 HEAD'
alias gfa='git fetch --all --tags --prune && git delete-merged-branches'
alias gcne='gc! --no-edit'
alias gcane='gca! --no-edit'
alias gcanep='gca! --no-edit && gp -f $1 $2'
alias gcls='gcl --depth 1 '
alias gcnep='gc! --no-edit && gp -f $1 $2'
alias grhd='git reset HEAD '
alias gcl='hub clone'
alias gcaanep='ga -A && gca! --no-edit && gp -f $1 $2'
alias glt='git log --decorate=full --simplify-by-decoration'
alias vi=$EDITOR
alias ssh='TERM=xterm ssh'
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'
export FZF_DEFAULT_OPTS="--no-mouse --inline-info"
export FZF_CTRL_R_OPTS="--no-mouse --inline-info"
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
eval "$(direnv hook zsh)"
unsetopt correct_all
unsetopt correct
DISABLE_CORRECTION="true"
test -e ${HOME}/.iterm2_shell_integration.zsh && source ${HOME}/.iterm2_shell_integration.zsh
# if [[ "$PROFILE_STARTUP" == true ]]; then
# zprof
# unsetopt xtrace
# exec 2>&3 3>&-
# fi
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh