-
Notifications
You must be signed in to change notification settings - Fork 4
/
.zshrc
281 lines (233 loc) · 8.35 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
export TERM="xterm-256color"
export COLORTERM="truecolor"
export EDITOR='vim'
export LANG=nl_NL.UTF-8
export LC_ALL=nl_NL.UTF-8
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
#Prevent less from taking full screen when the content is less than a single page
export LESS="-F -X -R $LESS"
export GOPATH=$HOME/go
export NVM_DIR=~/.nvm
export PATH=\
/usr/local/bin:\
/usr/local/sbin:\
/usr/bin:\
/bin:\
/usr/sbin:\
/sbin:\
/opt/puppetlabs/bin:\
$HOME/.gem/ruby/2.4.0/bin:\
/usr/local/opt/[email protected]/bin:\
${GOPATH//://bin:}/bin:\
"/Applications/Visual Studio Code.app/Contents/Resources/app/bin":\
$PATH
# setopt complete_aliases
# autoload -Uz compinit
# autoload -Uz compdef
# compinit
# Path to your oh-my-zsh configuration.
# ZSH=$HOME/.antigen/bundles/robbyrussell/oh-my-zsh
ZSH=$HOME/.oh-my-zsh
# zmodload zsh/zprof
# plugins=(brew composer forklift git git-extras github history history-substring-search jira node npm osx pow python rake symfony2 textmate tmux)
plugins=(git kubectl osx tmux vagrant docker bundler)
##########################################################
## ANTIGEN BEGIN
##########################################################
#source "${HOME}/vim-config/antigen.zsh"
#antigen use oh-my-zsh
#antigen bundle brew
#antigen bundle git
#antigen bundle git-extras
#antigen bundle github
#antigen bundle history
#antigen bundle history-substring-search
#antigen bundle kubectl
#antigen bundle node
#antigen bundle osx
#antigen bundle pow
#antigen bundle python
#antigen bundle rake
#antigen bundle tmux
#antigen bundle tmuxinator
#antigen bundle vagrant
#antigen bundle docker
# antigen bundle joel-porquet/zsh-dircolors-solarized.git
# antigen bundle zsh-users/zsh-syntax-highlighting
# antigen bundle composer
# antigen bundle forklift
# antigen bundle jira
# antigen bundle npm
# antigen bundle symfony2
# antigen bundle textmate
# antigen bundle stackexchange/blackbox
# antigen bundle arialdomartini/oh-my-git
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
# ZSH_THEME="robbyrussell"
# See: https://github.com/bhilburn/powerlevel9k/wiki/Stylizing-Your-Prompt
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(kubecontext dir rbenv virtualenv vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history battery time os_icon)
POWERLEVEL9K_COLOR_SCHEME='light'
POWERLEVEL9K_MODE='nerdfont-complete'
ZSH_THEME="powerlevel9k/powerlevel9k"
# antigen theme robbyrussell
# antigen theme arialdomartini/oh-my-git-themes oppa-lana-style
# antigen apply
##########################################################
## ANTIGEN END
##########################################################
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
alias dircolors='gdircolors'
alias mosh="mosh --server=\"LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/mosh-server\""
alias know="vim ~/.ssh/known_hosts"
alias hosts="sudo vim /etc/hosts"
alias psg="ps aux | grep -i "
# git aliases
alias gd="git diff --ws-error-highlight=new,old"
alias gpom="git push origin master"
alias gpull="git pull origin develop"
alias gpush="git push origin HEAD:refs/for/develop"
alias gs="git status"
# docker aliases
alias drmid='docker rmi $(docker images -f "dangling=true" -q)'
alias drma='docker rm $(docker ps -aq)'
alias dll='docker logs -f $(docker ps -q | head -1)'
# ls with color
alias ls='gls --color'
# recursive grep. Function, because I'm too lazy to type the closing dot.
function recgrep {
grep -rin $1 .
}
# Execute bash inside docker container $1
function dbash {
docker exec -it $1 /bin/bash;
}
# Clean up known_hosts when a host key changed using this macro and reconnect.
function sssh() {
ssh-keygen -R $1
ssh-keyscan $1 >> ~/.ssh/known_hosts >/dev/null 2>&1
ex +'g/^getaddr.*$/d' +'g/^#.*$/d' +'sort u' -cwq ~/.ssh/known_hosts
ssh $1
}
# Add .bashrc and .vimrc to vagrant-ssh
function vs (){
vagrant ssh $1 -- -At "echo \"$(cat ~/vim-config/ssh-alias)\" > \$HOME/.bashrc; echo \"$(cat ~/vim-config/ssh-vimrc)\" > \$HOME/.vimrc; bash --rcfile \$HOME/.bashrc "
}
#compdef vs='vagrant ssh'
# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"
# Comment this out to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"
# Uncomment to change how often before auto-updates occur? (in days)
export UPDATE_ZSH_DAYS=7
# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment following line if you want to disable command autocorrection
# DISABLE_CORRECTION="true"
# Uncomment following line if you want red dots to be displayed while waiting for completion
COMPLETION_WAITING_DOTS="true"
#SH_FILE_EXPANSION="true"
# Uncomment following line if you want to disable marking untracked files under
# VCS as dirty. This makes repository status check for large repositories much,
# much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# plugins=(brew composer forklift git git-extras github history history-substring-search jira node npm osx pow python rake symfony2 textmate tmux)
source $ZSH/oh-my-zsh.sh
# function powerline_precmd() {
# PS1="$(powerline-shell --shell zsh $?)"
# }
# function install_powerline_precmd() {
# for s in "${precmd_functions[@]}"; do
# if [ "$s" = "powerline_precmd" ]; then
# return
# fi
# done
# precmd_functions+=(powerline_precmd)
# }
# if [ "$TERM" != "linux" ]; then
# install_powerline_precmd
# fi
#if [[ -r ~/.credentials ]]; then
# source ~/.credentials
#fi
for method in GET HEAD POST PUT DELETE OPTIONS; do
alias "$method"="lwp-request -m '$method'"
done
alias reload!='. ~/.zshrc'
expand-or-complete-with-dots() {
echo -n "\e[31m......\e[0m"
zle expand-or-complete
zle redisplay
}
zle -N expand-or-complete-with-dots
bindkey "^I" expand-or-complete-with-dots
bindkey "^[[1;2D" backward-word
bindkey "^[[1;2C" forward-word
# bindkey "${terminfo[khome]}" beginning-of-line
# bindkey "${terminfo[kend]}" end-of-line
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
bindkey "\e[5~" beginning-of-history
bindkey "\e[6~" end-of-history
bindkey "\e[7~" beginning-of-line
bindkey "\e[3~" delete-char
bindkey "\e[2~" quoted-insert
function fractal {
local lines columns colour a b p q i pnew
((columns=COLUMNS-1, lines=LINES-1, colour=0))
for ((b=-1.5; b<=1.5; b+=3.0/lines)) do
for ((a=-2.0; a<=1; a+=3.0/columns)) do
for ((p=0.0, q=0.0, i=0; p*p+q*q < 4 && i < 32; i++)) do
((pnew=p*p-q*q+a, q=2*p*q+b, p=pnew))
done
((colour=(i/4)%8))
echo -n "\\e[4${colour}m "
done
echo
done
}
if [ -e ~/.secrets ]; then
source ~/.secrets
else
print "ZSH/404: .secrets file not found."
fi
eval $( dircolors -b $HOME/LS_COLORS )
source $HOME/vim-config/zsh-syntax-highlighting-filetypes.zsh
# if [ `uname` = Darwin ]; then
# source $(brew --prefix nvm)/nvm.sh
# fi
# The next line updates PATH for the Google Cloud SDK.
if [ -f "$HOME/google-cloud-sdk/path.zsh.inc" ]; then source "$HOME/google-cloud-sdk/path.zsh.inc"; fi
# The next line enables shell command completion for gcloud.
if [ -f "$HOME/google-cloud-sdk/completion.zsh.inc" ]; then source "$HOME/google-cloud-sdk/completion.zsh.inc"; fi
# source <(kubectl completion zsh)
# SSH host autocompletion
# local knownhosts
# knownhosts=( ${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*} )
# knownhosts=( ${${${${(f)"$(<$HOME/.nodes.txt)"}:#[0-9]*}%%\ *}%%,*} )
# zstyle ':completion:*:(ssh|scp|sftp):*' hosts $knownhosts
# zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}"
# compdef '_dispatch ssh ssh' s
compdef s=ssh
# ssh-add -A &> /dev/null
# Automatically start a new tmux session if none are active.
# It would be wise to have iTerm2 keybindings set up if this line is active,
# because tabs in iTerm2 don't work as expected anymore.
if [[ -o login ]] && [ -t "$fd" ] && [ `uname` = Darwin ]; then
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
$HOME/tmux-launch.sh
else
if [ "$TMUX" = "" ]; then tmux; fi
fi
# zprof