-
Notifications
You must be signed in to change notification settings - Fork 19
/
.zshrc
234 lines (185 loc) · 6.73 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
# 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
if [[ ! -f ~/.zinit/bin/zinit.zsh ]]; then
mkdir ~/.zinit
git clone https://github.com/zdharma-continuum/zinit.git ~/.zinit/bin
fi
# load zinit
source ~/.zinit/bin/zinit.zsh
# 快速目录跳转
zinit ice lucid wait='1'
# Turbo mode with "wait"
zinit light-mode lucid wait for \
is-snippet OMZ::lib/history.zsh \
MichaelAquilina/zsh-you-should-use \
zdharma-continuum/history-search-multi-word \
# atload"alias zi='zinit'"
# zinit ice wait"2" as"command" from"gh-r" lucid \
# mv"zoxide*/zoxide -> zoxide" \
# atclone"./zoxide init zsh > init.zsh" \
# atpull"%atclone" src"init.zsh" nocompile'!'
# zinit light ajeetdsouza/zoxide
# binary release, unpack provide fzf
zinit ice from"gh-r" as"program"
zinit light junegunn/fzf
zinit light Aloxaf/fzf-tab
# zinit ice from"gh-r" as"program" mv"docker* -> docker-compose" bpick"*linux*"
# zinit load docker/compose
zinit ice as"program" from"gh-r" mv"docker-c* -> docker-compose"
zinit light "docker/compose"
zinit load agkozak/zsh-z
# Ref: zdharma/fast-syntax-highlighting
# Note: Use wait 1 second works for kubectl
#zinit wait lucid for \
# atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay" \
# zdharma-continuum/fast-syntax-highlighting \
## atload"zpcdreplay" wait"1" \
# #OMZP::kubectl \
# blockf \
# zsh-users/zsh-completions \
# atload"!_zsh_autosuggest_start" \
# zsh-users/zsh-autosuggestions \
# as"completion" is-snippet \
# https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker \
# https://github.com/docker/compose/blob/master/contrib/completion/zsh/_docker-compose
# 语法高亮
zinit ice lucid wait='0' atinit='zpcompinit'
zinit light zdharma-continuum/fast-syntax-highlighting
# 自动建议
zinit ice lucid wait="0" atload='_zsh_autosuggest_start'
zinit light zsh-users/zsh-autosuggestions
# 补全
zinit ice lucid wait='0'
zinit light zsh-users/zsh-completions
# 加载 OMZ 框架及部分插件
zinit snippet OMZ::lib/completion.zsh
zinit snippet OMZ::lib/history.zsh
zinit snippet OMZ::lib/key-bindings.zsh
zinit snippet OMZ::lib/theme-and-appearance.zsh
zinit snippet OMZ::plugins/colored-man-pages/colored-man-pages.plugin.zsh
zinit snippet OMZ::plugins/sudo/sudo.plugin.zsh
#zinit snippet OMZ::plugins/git-flow/git-flow.plugin.zsh
zinit snippet OMZ::plugins/mvn/mvn.plugin.zsh
zinit snippet OMZ::plugins/tmux/tmux.plugin.zsh
zinit snippet OMZ::plugins/tmuxinator/tmuxinator.plugin.zsh
zinit snippet OMZ::plugins/command-not-found/command-not-found.plugin.zsh
zinit snippet OMZ::plugins/pip/pip.plugin.zsh
zinit ice lucid wait='1'
zinit snippet OMZ::plugins/git/git.plugin.zsh
# Gitignore plugin – commands gii and gi
zinit ice wait"2" lucid
zinit load voronkovich/gitignore.plugin.zsh
zinit load djui/alias-tips
export ASDF_DIR=$HOME/.asdf
# ASDF
if [ -d "$HOME/.asdf" ]; then
zinit ice wait lucid
zinit light asdf-vm/asdf
# OR
# load_asdf() {
# . $HOME/.asdf/asdf.sh
# }
#
# zinit light-mode wait lucid for \
# atload'load_asdf' \
# zdharma-continuum/null
fi
# zinit light denysdovhan/spaceship-prompt
zinit ice depth=1; zinit light romkatv/powerlevel10k
# zinit ice as"program" from"gh-r" mv"exa* -> exa" pick"exa/exa" lucid atload"alias ls='exa --icons'"
# zinit light ogham/exa
# OS specific plugins
case `uname` in
Darwin)
# zinit bundle kiurchv/asdf.plugin.zsh
;;
FreeBSD)
;;
esac
#if type brew &>/dev/null; then
# echo "brew completion"
# FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
# #fpath=$(brew --prefix)/share/zsh-completions:$fpath
# fpath=($HOME/.asdf/completions $fpath)
#fi
#. $(brew --prefix asdf)/asdf.sh
#. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash
# Compinit : After zinits, before cdreplay
# https://carlosbecker.com/posts/speeding-up-zsh/
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
autoload -Uz compinit
compinit
fi
fpath=(${ASDF_DIR}/completions $fpath)
autoload -Uz compinit
if [ -d "$HOME/.asdf" ]; then
source $HOME/.asdf/asdf.sh
source $HOME/.asdf/completions/asdf.bash
fi
# if [ $(date +'%j') != $(stat -f '%Sm' -t '%j' ~/.zcompdump) ]; then
# compinit;
# else
# compinit -C;
# fi
# kitty + complete setup zsh | source /dev/stdin
# Load the theme.
# zinit theme agnoster
# workaround for https://github.com/zsh-users/zinit/issues/675
# Tell zinit that you're done.
# zinit apply
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=6'
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi
#tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; }
source $HOME/dotfiles/zsh/common.zsh
source $HOME/dotfiles/zsh/keybindings.zsh
source $HOME/dotfiles/zsh/alias.zsh
source $HOME/dotfiles/zsh/env.zsh
source $HOME/dotfiles/zsh/fzf.zsh
source $HOME/dotfiles/zsh/github-copilot-cli.zsh
case `uname` in
Darwin)
source $HOME/dotfiles/zsh/osx.zsh
;;
FreeBSD)
;;
esac
if [[ -f ~/.zshrc.local ]]; then
source $HOME/.zshrc.local
fi
ZSH_DISABLE_COMPFIX=true
# fpath=(~/.zsh/completions $fpath)
# space
SPACESHIP_DIR_SHOW="${SPACESHIP_DIR_SHOW=true}"
SPACESHIP_DIR_PREFIX="${SPACESHIP_DIR_PREFIX="in "}"
SPACESHIP_DIR_SUFFIX="${SPACESHIP_DIR_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_DIR_TRUNC="0"
SPACESHIP_DIR_TRUNC_REPO="${SPACESHIP_DIR_TRUNC_REPO=true}"
SPACESHIP_DIR_COLOR="${SPACESHIP_DIR_COLOR="cyan"}"
# alias
# adb related
# usage adb-screencap > screen.png
alias adbcap="adb shell screencap -p"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh