-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
190 lines (155 loc) · 7.12 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
# zmodload zsh/zprof
# Path to your oh-my-zsh configuration.
DISABLE_AUTO_UPDATE="true"
ZSH=$HOME/.oh-my-zsh
# 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"
ZSH_THEME=""
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Set to this to use case-sensitive completion
CASE_SENSITIVE="true"
# Comment this out to disable weekly auto-update checks
#DISABLE_AUTO_UPDATE="true"
# 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 red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="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=(sudo git mvn extract safe-paste docker colored-man-pages tmux ng kubectl helm)
source $ZSH/oh-my-zsh.sh
HISTSIZE=10000000
SAVEHIST=10000000
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY # Share history between all sessions.
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file.
setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry.
setopt HIST_VERIFY # Don't execute immediately upon history expansion.
unsetopt correct_all
# Better bindings for up/down keys to search history
#if [ `uname` = "Linux" ]
#then
# bindkey "${terminfo[kcuu1]}" history-beginning-search-backward
# bindkey "${terminfo[kcud1]}" history-beginning-search-forward
#else
bindkey '^[[A' history-beginning-search-backward
bindkey '^[[B' history-beginning-search-forward
#fi
# Fast ctrl-z to re-enter vim
fancy-ctrl-z () {
if [[ $#BUFFER -eq 0 ]]; then
BUFFER="fg"
zle accept-line
else
zle push-input
zle clear-screen
fi
}
zle -N fancy-ctrl-z
bindkey '^Z' fancy-ctrl-z
# Customize to your needs...
export EDITOR=vim
export PAGER=less
alias enscript='enscript -2 -G -E -r -j'
alias rm='rm -v'
alias bc='bc -l'
alias cpan='cpanm'
alias parallel='parallel --citation'
alias openssl_verify='openssl s_client -connect'
alias k-unset='unset_k8s_context'
alias k-set='set_k8s_context'
alias k-ns='set_k8s_namespace'
alias d='docker'
alias de='docker exec -it'
alias dl='docker logs -f'
alias dr='docker run -it --rm'
alias dc='docker-compose'
alias -g DS="-o go-template='{{ range \$k, \$v := .data }}{{ \$k }}: {{ \$v | base64decode }}{{ \"\n\" }}{{ end }}'"
alias cat='bat'
unalias gcl
alias gcv='glab ci view'
alias gcl='glab ci list'
alias sd='skaffold dev --tolerate-failures-until-deadline=true'
alias less='less -RFX'
if [ `uname` != "Darwin" ]
then
alias ack='ack --color'
alias ssh='ssh -X'
alias vless='vim -u /usr/share/vim/vimcurrent/macros/less.vim'
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
else
alias ack='ack --color'
alias vless='vim -u /usr/share/vim/vim73/macros/less.vim'
alias vim='/opt/homebrew/bin/nvim'
alias krb='kinit --kdc-hostname=EASE.ED.AC.UK [email protected]'
alias top='top -o cpu'
alias chrome-debug='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222'
alias beep='echo -en "\007"'
export JAVA_HOME=`/usr/libexec/java_home -v 17`
export LSCOLORS=exgxbxdxcxegedabagacad
export EDITOR=nvim
fi
export LS_COLORS='rs=0:di=34:ln=36:mh=00:pi=33:so=35:do=35:bd=33:cd=33:or=31:su=37:sg=30:ca=30:tw=30:ow=34:st=37:ex=32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:';
eval "$(starship init zsh)"
# Kubernetes namespace autocomplete
function _kn() {
local cur prev opts
case "$COMP_CWORD" in
1)
opts="$(kubectl config get-contexts -o name 2>/dev/null)"
;;
2)
prev="${COMP_WORDS[COMP_CWORD-1]}"
[[ "$prev" = "." ]] && prev=$(kubectl config current-context)
[[ "$prev" = "-" ]] && return
if kubectl config get-contexts -o name | grep -q "^${prev}\$"
then
opts=$(kubectl --context=$prev get namespaces -o go-template --template='{{range .items}}{{.metadata.name}} {{end}}')
fi
;;
*)
return
;;
esac
COMPREPLY=($(compgen -W "${opts}" -- ${COMP_WORDS[COMP_CWORD]}))
return 0
}
autoload bashcompinit && bashcompinit
complete -F _kn set_k8s_context
export BAT_THEME=DarkNeon
export DOCKER_BUILDKIT=1
export PATH=$PATH:$HOME/src/env/bin
# Set ZSH tab complete colours to be the same as ls
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
[[ ! -f ~/.fzf.zsh && -x "$(command -v fzf)" ]] && source <(fzf --zsh)
export FZF_DEFAULT_COMMAND="fd --hidden --strip-cwd-prefix --exclude .git"
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="fd --type=d --hidden --strip-cwd-prefix --exclude .git"
if [ -e "/opt/homebrew/bin/mise" ]; then
eval "$(/opt/homebrew/bin/mise activate zsh)"
fi
if [ -e "$HOME/.acme.sh" ]; then
. "/Users/aseales/.acme.sh/acme.sh.env"
fi
if [ -e "$HOME/.config/glab-cli" ]; then
eval "$(glab completion -s zsh)"
fi
# zprof
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
[ -f ~/.fzf-git.sh/fzf-git.sh ] && source ~/.fzf-git.sh/fzf-git.sh
export PATH=/opt/homebrew/opt/postgresql@15/bin:$PATH