-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathdot_zshrc
205 lines (160 loc) · 4.69 KB
/
dot_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
# if you need to profile
# zmodload zsh/zprof
if [[ $INTELLIJ_ENVIRONMENT_READER ]]; then
return
fi
### ZINIT
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
[ ! -d $ZINIT_HOME ] && mkdir -p "$(dirname $ZINIT_HOME)"
[ ! -d $ZINIT_HOME/.git ] && git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
source "${ZINIT_HOME}/zinit.zsh"
# Load a few important annexes, without Turbo
# (this is currently required for annexes)
zinit light-mode for \
zdharma-continuum/zinit-annex-{'readurl','bin-gem-node','patch-dl','rust'}
### END ZINIT
if [ `tput colors` = "256" ]; then
if [[ $TERM_PROGRAM != "WarpTerminal" ]]; then
# zinit light romkatv/powerlevel10k
eval "$(starship init zsh)"
fi
fi
# PLUGINS
zinit ice depth=1
# ZVM_VI_INSERT_ESCAPE_BINDKEY=jk
# zinit light jeffreytse/zsh-vi-mode
zinit light zsh-users/zsh-completions
if uname -r |grep -q 'Microsoft' ; then
zinit light MichaelAquilina/zsh-auto-notify
fi
# zinit light zdharma-continuum/history-search-multi-word
# zinit snippet OMZ::lib/history.zsh
zinit snippet OMZ::plugins/git/git.plugin.zsh
# autocomplete
# zinit snippet OMZ::plugins/docker/_docker
# those should stay last
zinit light zsh-users/zsh-autosuggestions
# for some reason really slow in osx
# zinit light zdharma-continuum/fast-syntax-highlighting
#
# COMPINIT
autoload -Uz compinit
compinit
zinit cdreplay -q
# ENV VAR
export VOLTA_HOME="$HOME/.volta"
export EDITOR=nvim
export VISUAL=nvim
export MANGOHUD=1
# emacs
if [[ -r "$HOME/.config/emacs" ]]; then
export PATH="$PATH:$HOME/.config/emacs/bin"
fi
if [[ -r "$HOME/.zshrc.env" ]]; then
source "$HOME/.zshrc.env"
fi
# END ENV VAR
if [[ -r "$HOME/.pyenv" ]]; then
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
fi
if [[ -r "$HOME/go" ]]; then
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
fi
if [[ -r "/opt/homebrew/bin/bun" ]]; then
export PATH="$HOME/.bun/bin:$PATH"
fi
# awaits, necessary for vi mode
zinit ice lucid wait
# zinit snippet OMZP::fzf
# zinit light Aloxaf/fzf-tab
# zinit light Tarrasch/zsh-bd
# zinit snippet $HOME/.fzf.zsh
#
zinit ice atload"zpcdreplay" atclone'./zplug.zsh'
# zinit light g-plane/zsh-yarn-autocompletions
zinit ice atload"unalias zi"
# HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND=true
# zinit light zsh-users/zsh-history-substring-search
# bindkey '^[[A' history-substring-search-up
# bindkey '^[[B' history-substring-search-down
zinit load atuinsh/atuin
# zinit snippet OMZ::lib/key-bindings.zsh
# gh completion -s zsh > /Users/luca.trazzi/.zinit/completions/_gh
# https://cli.github.com/manual/gh_completion
# END PLUGINS
# HISTORY
export HISTORY_IGNORE="(ls|cd|pwd|exit|sudo reboot|history|cd -|cd ..)"
HISTSIZE=5000
HISTFILE=~/.zsh_history
SAVEHIST=$HISTSIZE
HISTDUP=erase
setopt appendhistory
setopt sharehistory
setopt hist_ignore_space
setopt hist_ignore_all_dups
setopt hist_save_no_dups
setopt hist_ignore_dups
setopt hist_find_no_dups
# END HISTORY
# FZF
export FZF_DEFAULT_COMMAND="find . -maxdepth 1"
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
# END FZF
# ALIASES
alias k='kubectl'
alias c='xclip -selection clipboard'
alias v='nvim'
alias nv='neovide'
alias ls='lsd'
alias l='ls -l'
alias la='ls -a'
alias lla='ls -la'
alias lt='ls --tree'
alias reload=". ~/.zshrc && echo 'ZSH config reloaded from ~/.zshrc'"
# alias v+='f(){ amixer -q sset Master "$@"%+; unset -f f; }; f'
# alias v-='f(){ amixer -q sset Master "$@"%-; unset -f f; }; f'
# alias v='f(){ amixer -q sset Master toggle; unset -f f; }; f'
alias grep='rg'
# alias find='fd'
# alias ps='procs'
alias crashed='journalctl --since=today'
alias ssk="kitty +kitten ssh"
alias lg="lazygit"
alias p="pnpm"
alias run="run.mjs"
alias zipgit="git archive HEAD -o ${PWD##*/}.zip"
# alias zip7git="7z a -bd ${PWD##*/}.7z * '-xr@./.gitignore'"
function addTodo() {
todoist add --date today -P 2211210927 "$1"
}
alias todo=addTodo
alias todos="todoist list"
alias pp='cd $(fd --full-path ~/repos/ -t d -d 2 | fzf)'
# END ALIASES
# pnpm
export PNPM_HOME="$HOME/Library/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
# pnpm end
# Shell integrations
if command -v fzf > /dev/null 2>&1; then
# eval "$(fzf --zsh)"
source <(fzf --zsh)
fi
if command -v zoxide > /dev/null 2>&1; then
eval "$(zoxide init zsh)"
fi
if command -v kubectl > /dev/null 2>&1; then
source <(kubectl completion zsh) # setup autocomplete in zsh into the current shell
source "$HOME/bin/functions/ks"
fi
# eval "$(zoxide init --cmd cd zsh)"
# tabtab source for packages
# uninstall by removing these lines
[[ -f ~/.config/tabtab/zsh/pnpm.zsh ]] && . ~/.config/tabtab/zsh/pnpm.zsh || true
# zprof