-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_zshrc
178 lines (134 loc) · 4.21 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
autoload -Uz compinit
compinit
## Settings
# Enable Ctrl-x-e to edit command line
bindkey -e
autoload -U edit-command-line
zle -N edit-command-line
bindkey '^xe' edit-command-line
bindkey '^x^e' edit-command-line
# only work perfectly solution
export WORDCHARS=
export EDITOR=vim
export LANG=en_US.UTF-8
export BAT_THEME="Catppuccin-mocha"
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
# use for bash lsp. NOTE not write bash that much, this lsp maybe not useful
export GLOB_PATTERN="**/*@(.sh|.inc|.bash|.command|.zsh|zshrc|zsh_*)"
## Alias
# alias ls to eza
alias ls=eza
alias ll='ls -alF -snewest -I .DS_Store'
alias l='ls -alF -snewest -I .DS_Store'
alias awk=gawk
# alias cat to bat
alias cat=bat
# alias top=btop
alias python=python3
# navi for ctrl-g
eval "$(navi widget zsh)"
# alias git to hub
eval "$(hub alias -s)"
alias chc="chezmoi cd"
alias cha="chezmoi add"
alias chd="chezmoi diff"
alias g=git
alias c=cargo
alias cn='cargo +nightly'
function proxy_on() {
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
export all_proxy=socks5://127.0.0.1:7890
echo -e "proxy on"
}
function proxy_off(){
unset http_proxy https_proxy all_proxy
echo -e "proxy off"
}
# TODO auto set proxy for new shell session
export https_proxy=http://127.0.0.1:7890
export http_proxy=http://127.0.0.1:7890
export all_proxy=socks5://127.0.0.1:7890
alias lg=lazygit
alias k=kubectl
alias ks='kubectl -n kube-system'
# TODO topgrade just upgrade not install new packages so brew dump file maybe no changes
alias topgrade='topgrade && brew bundle dump --force --file=~/.config/homebrew/Brewfile'
# install on new machine
# brew bundle install --file=~/.config/homebrew/Brewfile
function nvim_help() {
if [ $# -eq 0 ]
then
nvim .
else
nvim $1
fi
}
alias vim=nvim_help
alias vi=nvim_help
alias v=nvim_help
alias n=nvim_help
## Tools
# for ssh
export LC_ALL="en_US.UTF-8"
# HomeBrew
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/sbin:$PATH"
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:/Users/ruizhang/.local/bin
export PATH=$PATH:/Users/ruizhang/.config/shell-utils
export PATH=$PATH:/Users/ruizhang/.config/bin
export PATH=$PATH:$HOME/.luarocks/bin:
# ~/.tmux/plugins
export PATH=$HOME/.tmux/plugins/t-smart-tmux-session-manager/bin:$PATH
export GOKU_EDN_CONFIG_FILE=$HOME/.config/karabiner/karabiner.edn
export PATH="$PATH:/Users/ruizhang/Library/Application Support/Coursier/bin"
# config for ssl
export SSLKEYLOGFILE=/Users/ruizhang/keylog.txt
# HomeBrew END
## fnm
eval "$(fnm env)"
## fzf
# slow if source but normal for new shell session
export LS_COLORS="$(vivid generate catppuccin-mocha)"
## UI
# man page
#
export MANPAGER="/usr/local/bin/less -s -M +Gg"
# man-page colors
export LESS_TERMCAP_mb=$'\e[1;31m' # begin bold
export LESS_TERMCAP_md=$'\e[1;34m' # begin blink
export LESS_TERMCAP_so=$'\e[01;45;37m' # begin reverse video
export LESS_TERMCAP_us=$'\e[01;36m' # begin underline
export LESS_TERMCAP_me=$'\e[0m' # reset bold/blink
export LESS_TERMCAP_se=$'\e[0m' # reset reverse video
export LESS_TERMCAP_ue=$'\e[0m' # reset underline
export GROFF_NO_SGR=1 # for konsole
source <(kubectl completion zsh)
# z
eval "$(zoxide init zsh)"
source /Users/ruizhang/.config/broot/launcher/bash/br
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
source ~/.zsh/zsh-history-substring-search/zsh-history-substring-search.zsh
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
# export JAVA_HOME=$(/usr/libexec/java_home)
export JAVA_HOME=`/usr/libexec/java_home -v 21.0.1`
export BW_SESSION="XNhzIzxFPV+7GXjEgRgbNoF7N5LSQobUewEjC/7UiD1QdBBCjTjblTldAKMnd4z8wEzYmUNrH1roR7eV22+PLw=="
export XDG_CONFIG_HOME="$HOME/.config"
clear-ctrl-r() {
zle autosuggest-clear
# TODO clear autosuggestions before list history
zle _atuin_search_widget
}
zle -N clear-ctrl-r
export ATUIN_NOBIND="true"
eval "$(atuin init zsh)"
bindkey '^R' clear-ctrl-r
# remove duplicate in $PATH
typeset -U path
# highlight
source ~/.zsh/catppuccin_mocha-zsh-syntax-highlighting.zsh
source /Users/ruizhang/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
eval "$(starship init zsh)"