-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
273 lines (248 loc) · 7.24 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
271
272
273
#* zsh speed checker
if [ "$ZSHRC_PROFILE" != "" ]; then
zmodload zsh/zprof && zprof > /dev/null
fi
#* custom functions
source $HOME/dotfiles/.zsh/.zshfunc
# if hostname contains "DESKTOP" -> my home desktop
# else if contains "hpc" -> hpc cluster machine
# else -> WTH?
if [[ "$HOST" =~ "^DESKTOP-DLL*" ]]; then
source ~/dotfiles/.zsh/.zshhome
source $HOME/dotfiles/.zsh/hpcfunctions.zsh
useproxy
elif [[ "$HOST" =~ "^hpc*" ]]; then
source ~/dotfiles/.zsh/.zshwork
source $HOME/dotfiles/proxy/proxy_adress.zsh
source $HOME/dotfiles/.zsh/hpcfunctions.zsh
elif [[ "$HOST" =~ "^ip*" ]]; then
source ~/dotfiles/.zsh/.zshaws
elif [[ "$HOST" =~ "^hodake*" ]]; then
source ~/dotfiles/.zsh/.zshhome
else
source ~/dotfiles/.zsh/.zshhome;
fi
#* Path configuration
path_append "$HOME/.local/bin"
path_append "/usr/local/bin"
path_append "/usr/bin"
path_append "$HOME/.cargo/bin"
path_append "$HOME/go/bin"
path_append "$HOME/.poetry/bin"
#* Util command
alias pwdc='pwd | tr -d "\n" | pbcopy'
alias pi="pip install"
alias ai="sudo apt install"
#* axel
alias Axel="axel -n 10 --insecure"
#* Zellij
alias zl="zellij list-sessions"
alias zelij=zellij
#* Prompt
# disable showing conda environment on prompt
export VIRTUAL_ENV_DISABLE_PROMPT=1
# posh theme
eval "$(oh-my-posh init zsh --config $poshpath)"
# eval "$(starship init zsh)"
#* zoxide
eval "$(zoxide init zsh)"
alias z="pushd ./ && z"
alias ..="cd .."
alias ...="cd ../.."
#* NeoVim
# open man with vim
export MANPAGER="nvim -c 'set ft=man' -"
export EDITOR='nvim'
# alias
alias vi="nvim"
alias vim="nvim"
alias view="nvim -R"
alias vimconfig="vim $HOME/dotfiles/.config/nvim/init.vim"
#* Python
alias ipo="ipython"
#* Zsh configuration
# alias
alias zshconfig="vim $HOME/dotfiles/.zshrc"
alias reload="exec zsh"
# settings
### beep
setopt no_beep
### bracket
setopt auto_param_keys
### color
#? colors has gone to sheldon
# autoload -Uz colors && colors
### autocomplete
#? compinit has gone to sheldon
# autoload -Uz compinit && compinit -C
setopt magic_equal_subst
### word select per slash
autoload -U select-word-style
select-word-style bash
### share history
setopt histignorealldups
setopt sharehistory
setopt hist_no_store
setopt hist_ignore_space
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
LISTMAX=1000
### move without cd
setopt auto_cd
setopt auto_pushd
setopt pushd_ignore_dups
### auto correct ###
# setopt correct
### key binding ###
bindkey '^[[1;5C' forward-word #? Ctrl + ->
bindkey '^[[1;5D' backward-word #? Crtl + <-
bindkey '^[[H' beginning-of-line #? Home
bindkey '^[[F' end-of-line #? End
bindkey '^[[3~' delete-char #? Delete
bindkey '^I' complete-word #? tab complete
bindkey '^E' end-of-line #? Ctrl + e = End
bindkey '^q' push-line-or-edit
bindkey '^x' push-line-or-edit
### glob
setopt extended_glob
### wdchar
WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
#* Git
alias gp='git pull'
alias gP='git push'
alias ga='git add .'
alias gc='git commit -m'
alias gs='git status'
alias gb='git branch'
alias gl='git clone'
alias cout='git checkout'
# lazygit
alias lg='lazygit'
# git path
function gitroot(){
export git_root=$(git rev-parse --show-toplevel)
echo $git_root
}
function gitMain() {
git config --global user.name "dakesan"
git config --global user.email [email protected]
# git config --list
}
function gitPri() {
git config --global user.name "snitch0"
git config --global user.email [email protected]
# git config --list
}
function gitReverse() {
git reset --soft HEAD\^
}
alias gr='gitReverse'
#* R/Python/SQL
# alias sl="sqlite3"
#* exa
alias e='exa --icons'
alias l='e -l'
alias k=l
alias ls=e
alias ea='exa -ag --icons'
alias la=ea
alias ee='exa -aal -g --git --icons'
alias ll=ee
alias et='exa -T -g -L 3 -a -I "node_modules|.git|.cache" --icons'
alias lt=et
alias eta='lt -l --git'
alias lta=eta
#* fzf
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# zstyle ':autocomplete:*' insert-unambiguous yes
# no: Tab inserts the top completion.
# yes: Tab first inserts a substring common to all listed completions, if any.
# zstyle ':autocomplete:*' fzf-completion yes
# no: Tab uses Zsh's completion system only.
# yes: Tab first tries Fzf's completion, then falls back to Zsh's.
# ⚠️ NOTE: This setting can NOT be changed at runtime and requires that you
# have installed Fzf's shell extensions.
# zstyle ':autocomplete:recent-dirs' backend zoxide
# cdr: Use Zsh's `cdr` function to show recent directories as completions.
# no: Don't show recent directories.
# zsh-z|zoxide|z.lua|z.sh|autojump|fasd: Use this instead (if installed).
# ⚠️ NOTE: This setting can NOT be changed at runtime.
#* sheldon
eval "$(sheldon source)"
#* zinit
### 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
#
# # Load a few important annexes, without Turbo
# # (this is currently required for annexes)
#
# zinit light zdharma-continuum/zinit-annex-as-monitor
# zinit light zdharma-continuum/zinit-annex-bin-gem-node
# zinit light zdharma-continuum/zinit-annex-patch-dl
# zinit light zdharma-continuum/zinit-annex-rust
# zinit blockf lucid light-mode for \
# zdharma/history-search-multi-word \
# marlonrichert/zsh-autocomplete \
# zsh-users/zsh-autosuggestions \
# zdharma-continuum/fast-syntax-highlighting \
# supercrabtree/k \
# dakesan/git-use-ssh
# # 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 \
# # zsh-users/zsh-syntax-highlighting \
# # zdharma/history-search-multi-word \
# # marlonrichert/zsh-autocomplete
#
# # zinit ice depth=1
# # zinit light jeffreytse/zsh-vi-mode
#
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
#* poetry
export PATH="$HOME/.poetry/bin:$PATH"
#* golang
export PATH=$PATH:/usr/local/go/bin
# # >>> conda initialize >>>
# # !! Contents within this block are managed by 'conda init' !!
# __conda_setup="$('/work1/oodake/mambaforge/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
# if [ $? -eq 0 ]; then
# eval "$__conda_setup"
# else
# if [ -f "/work1/oodake/mambaforge/etc/profile.d/conda.sh" ]; then
# . "/work1/oodake/mambaforge/etc/profile.d/conda.sh"
# else
# export PATH="/work1/oodake/mambaforge/bin:$PATH"
# fi
# fi
# unset __conda_setup
#
# if [ -f "/work1/oodake/mambaforge/etc/profile.d/mamba.sh" ]; then
# . "/work1/oodake/mambaforge/etc/profile.d/mamba.sh"
# fi
# # <<< conda initialize <<<
#
#
# # aws
# if type "aws" > /dev/null; then
# autoload
# complete -C '/usr/local/bin/aws_compiler' aws
# fi
#
setopt autocd
autoload -Uz compinit
compinit