-
Notifications
You must be signed in to change notification settings - Fork 2
/
zshrc
270 lines (212 loc) · 7.78 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
# avoid problems with emacs tramp
[[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return
# 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)
# NOTE that fasd needs the executable fasd installed
# NOTE do NOT enable the tmux plugin! It breaks the last-working-dir functionality
#plugins=(last-working-dir zsh-navigation-tools rvm web-search bundler ruby git gem git-extras github vi-mode wd fabric docker docker-compose archlinux colorize alias-tips fasd zsh-autosuggestions dircycle safe-paste ssh-agent z extract mise)
#ZSH_AUTOSUGGEST_STRATEGY=(history completion)
# to install autosuggestions plugin:
# git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# to install alias-tips plugin:
# git clone https://github.com/djui/alias-tips ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/alias-tips
source /opt/homebrew/opt/zinit/zinit.zsh
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
# 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-rust
### End of Zinit's installer chunk
# Autosuggestions
zinit ice wait lucid atload'_zsh_autosuggest_start'
zinit light zsh-users/zsh-autosuggestions
# Plugin history-search-multi-word loaded with investigating.
#zinit load zdharma-continuum/history-search-multi-word
# allow cd ... = cd ../.. etc
zinit autoload'#manydots-magic' for twang817/zsh-manydots-magic
# Two regular plugins loaded without investigating.
# Syntax Highlight
zinit light zdharma-continuum/fast-syntax-highlighting
# Alias Tips
zinit light djui/alias-tips
export ZSH_PLUGINS_ALIAS_TIPS_TEXT="💡 Alias tip: "
# Git
zi snippet OMZL::git.zsh
zi snippet OMZP::git
# Git Fuzzy
zinit ice as"program" pick"bin/git-fuzzy"
zinit light bigH/git-fuzzy
# Mise
zi snippet OMZP::mise
# Z (like autojump)
zi snippet OMZP::z
# lolcats aliases
zi snippet OMZP::lol
# remember last working directory in newly started shells
zi snippet OMZP::last-working-dir
# emacs shortcuts
#zi snippet OMZP::emacs
# vi mode
zi snippet OMZP::vi-mode
# fzf
zi snippet OMZP::fzf
# fzf ssh
zinit light sunlei/zsh-ssh
# Load starship theme
# line 1: `starship` binary as command, from github release
# line 2: starship setup at clone(create init.zsh, completion)
# line 3: pull behavior same as clone, source init.zsh
zinit ice as"command" from"gh-r" \
atclone"./starship init zsh > init.zsh; ./starship completions zsh > _starship" \
atpull"%atclone" src"init.zsh"
zinit light starship/starship
export ATUIN_NOBIND="true"
zinit load atuinsh/atuin
#eval "$(atuin init zsh --disable-up-arrow)"
bindkey '^r' atuin-search
setopt autocd autopushd
# Customize to your needs...
DEFAULT_USER="svk"
# autoload -U zmv
# alias mmv='noglob zmv -W'
# # Settings for the zsh-navigation-tools
# autoload znt-history-widget
# zle -N znt-history-widget
# bindkey "^R" znt-history-widget
# #znt_cd_hotlist=( "~/development/pa/rho" "~/development/pa/psi" "~/development/sc/webapp"
# #"~/development/sc/graphical_client" "~/development/sc/client_server"
# #)
# #zle -N znt-cd-widget
# #bindkey "^J" znt-cd-widget
# call file manager with Ctrl-K
# jumps to the selected directory when quit
start_filemanager() {
local dst=$(command vifm --choose-dir - $PWD < $TTY)
if [ -z "$dst" ]; then
echo 'Directory picking cancelled/failed'
return 1
fi
cd "$dst"
zle reset-prompt
}
zle -N start_filemanager
bindkey "^K" start_filemanager
# always do pushd when cding, so you can always navigate back by calling popd (even multiple times, which doesn't work with cd -)
setopt AUTO_PUSHD
setopt PUSHD_IGNORE_DUPS
# enable rvm
#[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
# dircycle with Ctrl-H and Ctrl-L
#bindkey -c '^H' cd ..
#bindkey '^L' insert-cycledright
# tell Java that XMonad is non-reparenting (prevents blank windows of java applications)
export _JAVA_AWT_WM_NONREPARENTING=1
function gitrmtag () {
declare -a refs
local index=1
for tag in $@
do
refs[index++]=":refs/tags/$tag"
done
git push origin "${refs[@]}" && git tag -d "$@"
}
export EDITOR="nvim"
#alias docker=podman
alias dockercleancontainers="docker ps -a -f status=exited -q | xargs docker rm"
alias dockercleanimages="docker images -f dangling=true -q | xargs docker rmi"
alias dockerclean="dockercleancontainers && dockercleanimages"
alias dc="docker-compose"
alias pa="cd $HOME/development/pa"
alias sc="cd $HOME/development/sc"
alias ls="eza --icons=auto --classify=auto"
alias ll="eza --classify=auto --icons=auto --long --color-scale=all --color-scale-mode=fixed"
alias db="dropbox-cli"
alias cat=bat
#alias find=fd
alias gcb="./gradlew clean build"
alias gct="./gradlew clean check"
alias gcr="./gradlew clean run"
# ps + grep.
# see https://github.com/blueyed/oh-my-zsh/blob/a08181210b47625efdc8480e628b0155bff392c9/lib/aliases.zsh#L10-L18
pg() {
local pids
pids=$(pgrep -f $@)
if [[ ! -n $pids ]]; then
echo "No processes found." >&2; return 1
fi
ps up $(pgrep -f $@)
}
if [[ "$(hostname)" == "daltigoth" ]]; then
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
fi
# initialize rbenv (ruby version manager)
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
alias cherry="xmodmap ~/.Xmodmap_cherry"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
unalias gr # zsh git plugin defines this alias but we want to use the gr tool
export GOPATH=$HOME/go
export PATH="$PATH:$GOPATH/bin"
export PATH="$PATH:/home/linuxbrew/.linuxbrew/bin"
export PATH="$PATH:$HOME/.emacs.d/bin"
if [[ "$(hostname)" == "Svens-Air.localdomain" || "$(hostname)" == "istar.localdomain" || "$(hostname)" == "Sven’s-MacBook-Air" ]]; then
export PATH="$PATH:$(brew --prefix python)/libexec/bin"
export PATH="$PATH:/Users/sven/Library/Python/3.11/bin"
fi
export BAT_THEME="Monokai Extended Light"
export TLDR_COLOR_BLANK="white"
export TLDR_COLOR_NAME="cyan"
export TLDR_COLOR_DESCRIPTION="yellow"
export TLDR_COLOR_EXAMPLE="green"
export TLDR_COLOR_COMMAND="blue"
export TLDR_COLOR_PARAMETER="magenta"
export TLDR_CACHE_ENABLED=1
export TLDR_CACHE_MAX_AGE=720
export MOZ_ENABLE_WAYLAND=1
export PATH="$PATH:$HOME/.npm-global/bin"
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
alias wlan="wicd-cli --wireless"
alias f=frontastic
alias mp=multipass
export AICHAT_CONFIG_DIR=$HOME/.config/aichat
alias ai="aichat"
alias aic="aichat --role coder"
alias ais="aichat --role shell"
source $HOME/.config/broot/launcher/bash/br
#bindkey -s "^J" "br^M"
#
alias vi=nvim
# refresh timeout every time using sudo
alias sudo='sudo -v; sudo '
alias _=sudo
sshfm() {
if (( # == 0 )); then
kitty +kitten ssh vagrant@$(grep remoteserverhostname frontastic.toml|cut -d\' -f2)
else
kitty +kitten ssh vagrant@$1
fi
}
svrestart() {
ssh vagrant@$(grep remoteserverhostname frontastic.toml|cut -d\' -f2) sudo supervisorctl restart all
}
# not working on mac, needs phpenv
#export PATH="$HOME/.phpenv/bin:$PATH"
#eval "$(phpenv init -)"
alias sshk='kitty +kitten ssh'
eval "$(direnv hook zsh)"
#eval "$(starship init zsh)"
alias cdr=grt
export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"
alias gs="git branch | grep -v \"^\*\" | fzf --height=20% --reverse --info=inline | xargs git switch"
# change to frontastic directory (ctrl-x+f)
function cdfrontastic() { cd ~/development/frontastic; zle reset-prompt; zle redisplay}
zle -N cdfrontastic
bindkey '^xf' cdfrontastic
alias lg=lazygit
alias gama='GITHUB_TOKEN="$(gh auth token)" gama'
alias pubip='curl -s ifconfig.me'