-
Notifications
You must be signed in to change notification settings - Fork 20
/
.zshrc
253 lines (213 loc) · 8.01 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
# credits https://pastebin.com/Tgji4PZv
# zinit {{{
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
source "${ZINIT_HOME}/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
# }}}
# prezto {{{
zstyle ':prezto:*:*' case-sensitive 'no'
zstyle ':prezto:*:*' color 'yes'
zinit ice svn; zinit snippet PZT::modules/helper
zinit ice svn; zinit snippet PZT::modules/environment
zinit ice svn; zinit snippet PZT::modules/terminal
zinit ice svn; zinit snippet PZT::modules/editor
zinit ice svn silent; zinit snippet PZT::modules/gpg
zinit ice svn silent pick"init.zsh" lucid; zinit snippet PZT::modules/utility
# }}}
# colors {{{
export DRACULA_DISPLAY_GIT=0
zinit ice pick"lib/async.zsh" src"dracula.zsh-theme"; zinit light dracula/zsh
export FZF_DEFAULT_OPTS='--color=fg:#f8f8f2,bg:#282a36,hl:#bd93f9 --color=fg+:#f8f8f2,bg+:#44475a,hl+:#bd93f9 --color=info:#ffb86c,prompt:#50fa7b,pointer:#ff79c6 --color=marker:#ff79c6,spinner:#ffb86c,header:#6272a4'
# }}}
# misc plugins {{{
zinit ice from"gh-r" as"program" bpick"*x86_64-unknown-linux-gnu*" pick"fd-*/fd"; zinit light sharkdp/fd
zinit ice pick"bd.zsh"; zinit light Tarrasch/zsh-bd
zinit light djui/alias-tips
zinit ice from"gh-r" as"program" bpick"*x86_64-unknown-linux-gnu*" pick"lsd-*/lsd"; zinit light lsd-rs/lsd
zinit ice from"gh-r" as"program" pick"diff-so-fancy"; zinit light so-fancy/diff-so-fancy
zinit ice from"gh-r" as"program" bpick"*Linux_64bit_Portable*" mv"GalaxyBudsClient* -> GalaxyBudsClient"; zinit light ThePBone/GalaxyBudsClient
# }}}
# prompt {{{
zinit ice from"gh-r" as"program" bpick"*x86_64-unknown-linux-gnu*" pick"starship"; zinit light starship/starship
eval "$(starship init zsh)"
# }}}
# tmux {{{
zstyle ':prezto:module:tmux:session' name '0'
# [[ -n $DISPLAY ]] && zstyle ':prezto:module:tmux:auto-start' local 'yes'
zinit ice svn; zinit snippet PZT::modules/tmux
zinit ice lucid wait'!0a' as'null' id-as'tpm' atclone'mkdir -p $HOME/.tmux/plugins; ln -sf $ZINIT[PLUGINS_DIR]/tpm $HOME/.tmux/plugins/tpm' ; zinit light tmux-plugins/tpm
# }}}
# fzf / zoxide {{{
zinit ice as"program" pick="bin/(fzf|fzf-tmux)" atclone="\cp -f shell/completion.zsh _fzf_completion" atpull"%atclone" make="install"; zinit light junegunn/fzf
zinit ice from"gh-r" as"program" bpick"*x86_64-unknown-linux*.tar.gz"; zinit light ajeetdsouza/zoxide
# }}}
# completion {{{
zinit ice svn wait silent pick"init.zsh" blockf; zinit snippet PZT::modules/completion
unsetopt CORRECT
setopt ALWAYS_TO_END
setopt AUTO_LIST
setopt AUTO_PARAM_SLASH
setopt COMPLETE_ALIASES
setopt COMPLETE_IN_WORD
setopt EXTENDED_GLOB
setopt FLOW_CONTROL
setopt MENU_COMPLETE
setopt NO_NOMATCH
setopt PATH_DIRS
# }}}
# suggestions {{{
zinit ice wait atload"_zsh_autosuggest_start" lucid; zinit light zsh-users/zsh-autosuggestions
# }}}
# history {{{
zinit ice svn; zinit snippet PZT::modules/history
zinit ice wait"1" silent pick"zsh-history-substring-search.plugin.zsh" lucid; zinit light zsh-users/zsh-history-substring-search
zinit ice wait"1" silent pick"history-search-multi-word.plugin.zsh" lucid; zinit light zdharma-continuum/history-search-multi-word
zstyle ":plugin:history-search-multi-word" active "standout"
# }}}
# load everything {{{
autoload -Uz compinit
compinit
zinit cdreplay -q
# }}}
# must be called after compinit
eval "$(zoxide init zsh)"
# disable C-s stopping receiving keyboard signals.
stty start undef
stty stop undef
# vi mode {{{
bindkey -v
# export KEYTIMEOUT=1 # 100 ms vim mode change key timeout
bindkey -M viins 'jj' vi-cmd-mode
bindkey '^a' beginning-of-line
bindkey '^e' end-of-line
bindkey '^b' backward-word
bindkey '^f' forward-word
bindkey '^p' up-history
bindkey '^n' down-history
bindkey '^?' backward-delete-char # backspace and ^h working even after returning from command mode
bindkey '^h' backward-delete-char
# }}}
# terminal {{{
setopt PROMPT_SUBST
autoload -Uz colors && colors
autoload -Uz promptinit && promptinit
# }}}
# shell dev env {{{
zinit from"gh-r" as"program" mv"direnv* -> direnv" atclone'./direnv hook zsh > zhook.zsh' atpull'%atclone' pick"direnv" src="zhook.zsh" for direnv/direnv
zinit ice from"gh-r" as"program" pick"lnav-*/lnav" ; zinit light tstack/lnav
# }}}
# Linux Home Brew {{{
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# }}}
# java {{{
export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
export PATH="$JAVA_HOME/bin:$PATH"
# }}}
# clojure {{{
zinit ice from"gh-r" as"program" pick"bb"; zinit light babashka/babashka
zinit ice from"gh-r" as"program" bpick"zprintl-*" mv"zprintl-* -> zprint"; zinit light kkinnear/zprint
# }}}
# python {{{
zinit ice as'command' atclone'PYENV_ROOT="$PWD" ./libexec/pyenv init - > zpyenv.zsh && git clone https://github.com/pyenv/pyenv-virtualenv ./plugins/pyenv-virtualenv' atinit'export PYENV_ROOT="$PWD"' atpull"%atclone" pick'bin/pyenv' src"zpyenv.zsh" nocompile'!' ; zinit light pyenv/pyenv
export PATH="$HOME/.local/bin:$PATH"
export ZSH_PYENV_LAZY_VIRTUALENV="true"
export PYENV_VIRTUALENV_DISABLE_PROMPT=1
zinit ice pick="pyenv-lazy.plugin.zsh" ; zinit light davidparsson/zsh-pyenv-lazy
# }}}
# javascript {{{
export PATH="$(yarn global bin):$PATH"
# }}}
# jq {{{
export JQ_COLORS='0;31:0;39:0;39:0;39:0;32:1;39:1;39'
zinit ice from"gh-r" as"program" mv"yq_* -> yq" ; zinit light mikefarah/yq
# }}}
# markdown {{{
zinit ice from"gh-r" as"program" ; zinit light charmbracelet/glow
# }}}
# GPT {{{
zinit ice from"gh-r" as"program" ver"cli/v1.0.0" ; zinit light plandex-ai/plandex
# shell-gpt
_sgpt_zsh() {
if [[ -n "$BUFFER" ]]; then
_sgpt_prev_cmd=$BUFFER
BUFFER+="⌛"
zle -I && zle redisplay
BUFFER=$(sgpt --shell <<< "$_sgpt_prev_cmd" --no-interaction)
zle end-of-line
fi
}
zle -N _sgpt_zsh
bindkey '^L' _sgpt_zsh
# }}}
# source secret env keys, etc.
source $HOME/.zsh-secrets
# aliases {{{
alias c="z"
alias c-="c -"
alias cd..="c .."
alias cat="batcat"
alias ls="lsd --group-dirs first"
alias tailf="tail -f"
alias grep="rg"
alias ag="rg"
alias tree="lsd --tree"
alias vi="nvim"
# tcpdump all requests made by given process
alias sysdig="sudo sysdig"
alias csysdig="sudo csysdig"
httpdump() { sysdig -s 2000 -A -c echo_fds proc.name=$1; }
# }}}
# git {{{
zinit ice from"gh-r" as"program" pick"gh_*/bin/gh" ; zinit light cli/cli
zinit light paulirish/git-open
zinit ice from"gh-r" as"program"; zinit light jesseduffield/lazygit
# scm_breeze {{{
SCM_BREEZE_DISABLE_ASSETS_MANAGEMENT="true"
zinit ice atclone"$ZINIT[PLUGINS_DIR]/scmbreeze---scm_breeze/install.sh" atpull"%atclone" pick"scm_breeze.sh"; zinit light scmbreeze/scm_breeze
# }}}
# aliases {{{
alias gc="g c"
alias ga="g add"
alias gmv="g mv"
alias grs="git reset"
alias gl="g l"
alias gll="g ll"
alias gd="git d"
alias gds="git ds"
alias gdc="git dc"
alias gsh="g sh"
alias grp="g rp"
alias gbr="g br"
alias gbdr="g bdr"
alias gbdm="g bdm"
alias gprune="g prune"
# }}}
# }}}
# vim {{{
zinit ice from"gh-r" as"program" mv"tree-sitter* -> tree-sitter" ; zinit light tree-sitter/tree-sitter
# }}}
# docker {{{
export USE_GKE_GCLOUD_AUTH_PLUGIN=True
zinit ice from"gh-r" as"program" bpick"*Linux_amd64*"; zinit light derailed/k9s
zinit ice id-as"k9s-theme" cloneonly depth"1" atclone'mkdir -p $HOME/.config/k9s; ln -sf $ZINIT[PLUGINS_DIR]/k9s-theme/skins/dracula.yml $HOME/.config/k9s/skin.yml' atpull"%atclone"; zinit load derailed/k9s
alias dr="docker run --rm -it"
alias di="docker images | head -n 1 && docker images | tail -n +2 | sort"
alias dps="docker ps -a"
alias drm="docker rm"
alias drmi="docker rmi"
alias drmcd='drm $(dps -q -f status=exited -f status=created)'
alias drmvd='docker volume rm $(docker volume ls -q -f dangling=true)'
alias drmid='drmi $(docker images -q -f dangling=true)'
alias dpurge="drmcd ; drmvd ; drmid ; docker network prune -f"
alias dc="docker compose"
# }}}
# syntax highlighting {{{
# NOTE must be last plugin to load
zinit ice pick"zsh-syntax-highlighting.sh" lucid ; zinit light dracula/zsh-syntax-highlighting
# https://github.com/dracula/zsh-syntax-highlighting/issues/7
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main)
zinit ice wait lucid atinit"zpcompinit; zpcdreplay"; zinit light zsh-users/zsh-syntax-highlighting
# }}}
# vim:foldlevel=0
# vim:foldmethod=marker