-
Notifications
You must be signed in to change notification settings - Fork 1
/
.zshrc
194 lines (149 loc) · 5.4 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
# 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
### Added by Zinit's installer
if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \
print -P "%F{33} %F{34}Installation successful.%f%b" || \
print -P "%F{160} The clone has failed.%f%b"
fi
source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
#=== THEME ============================================
# Powerlevel10K theme
typeset -g POWERLEVEL9K_INSTANT_PROMPT=off
zinit ice depth"1" # git clone depth
zinit light romkatv/powerlevel10k
# Load a few important annexes, without Turbo
# (this is currently required for annexes)
zinit light-mode for \
zdharma-continuum/zinit-annex-as-monitor \
zdharma-continuum/zinit-annex-bin-gem-node \
zdharma-continuum/zinit-annex-patch-dl \
zdharma-continuum/zinit-annex-submods \
zdharma-continuum/zinit-annex-binary-symlink
#=== GITHUB BINARIES ==================================
zi from'gh-r' lbin'!' nocompile for \
@dandavison/delta @junegunn/fzf \
@koalaman/shellcheck @pemistahl/grex \
@melbahja/got @r-darwish/topgrade \
@sharkdp/fd @sharkdp/hyperfine \
lbin'!* -> jq' @stedolan/jq \
lbin'!* -> shfmt' @mvdan/sh \
lbin'!**/nvim' @neovim/neovim \
lbin'!**/rg' @BurntSushi/ripgrep
# z
zinit ice wait blockf lucid
zinit light rupa/z
# z tab completion
zinit ice wait lucid
zinit light changyuheng/fz
# z / fzf (ctrl-g)
zinit ice wait lucid
zinit light andrewferrier/fzf-z
zinit ice wait lucid
zinit light unixorn/fzf-zsh-plugin
# cd
zinit ice wait lucid
zinit light changyuheng/zsh-interactive-cd
bindkey -r '^[[A'
bindkey -r '^[[B'
function __bind_history_keys() {
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
}
# History substring searching
zinit ice wait lucid atload'__bind_history_keys'
zinit light zsh-users/zsh-history-substring-search
# autosuggestions, trigger precmd hook upon load
zinit ice wait lucid atload'_zsh_autosuggest_start'
zinit light zsh-users/zsh-autosuggestions
export ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=10
# Tab completions
zinit ice wait lucid blockf atpull'zinit creinstall -q .'
zinit light zsh-users/zsh-completions
# Syntax highlighting
#zinit ice wait lucid atinit'zpcompinit; zpcdreplay'
#zinit light zdharma/fast-syntax-highlighting
zinit wait lucid for \
atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay" \
zdharma-continuum/fast-syntax-highlighting \
blockf \
zsh-users/zsh-completions \
atload"!_zsh_autosuggest_start" \
zsh-users/zsh-autosuggestions
zinit light supercrabtree/k
zinit light peterhurford/git-it-on.zsh
zinit light chrissicool/zsh-256color
zinit light djui/alias-tips
zinit ice wait lucid
zinit light unixorn/git-extra-commands
### End of Zinit's installer chunk
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# Binaries
export PATH=$PATH:"$HOME/.local/bin"
export PATH=$PATH:/snap/bin
# Nvidia CUDA
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
# Alias
alias get="aria2c -x 16 -s 16 -j 16 $@"
alias open="xdg-open $@"
# Go
export GOPATH="$HOME/go"
export PATH="$HOME/go/bin:$PATH"
# Pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(/home/warlock/.pyenv/bin/pyenv init -)"
export PATH="$PATH:home/warlock/.pyenv/versions/3.8.9/bin"
# Rust
source $HOME/.cargo/env
export PATH=$PATH:$HOME/.cargo/bin
# Poetry
export PATH="$HOME/.poetry/bin:$PATH"
# Volta
export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"
# pnpm
export PNPM_HOME="/home/warlock/.local/share/pnpm"
export PATH="$PNPM_HOME:$PATH"
# bun completions
[ -s "/home/warlock/.bun/_bun" ] && source "/home/warlock/.bun/_bun"
# Temp directory
tmp() {
cd `mktemp -d`
}
uuid() {
uuidgen | xsel -b
}
# fnm
export PATH="/home/warlock/.local/share/fnm:$PATH"
eval "`fnm env`"
eval "$(fnm env --use-on-cd)"
# SSH
alias sshp="ssh -o PreferredAuthentications=password $@"
# Cleanup
pyclean () {
find . -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
}
npmclean() {
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
}
#export NVM_DIR="$HOME/.reflex/.nvm"
#[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
#[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# github.com/jdxcode/rtx
eval "$(rtx activate zsh)"
# bun completions
[ -s "/home/warlock/.reflex/.bun/_bun" ] && source "/home/warlock/.reflex/.bun/_bun"
# Wasmtime
export WASMTIME_HOME="$HOME/.local/share/rtx/installs/wasmtime/latest"
export PATH="$WASMTIME_HOME/bin:$PATH"