-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_zshrc
131 lines (105 loc) · 3.36 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
# .zshrc
## Zinit Core config
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
zinit light-mode for \
zdharma-continuum/zinit-annex-as-monitor \
zdharma-continuum/zinit-annex-bin-gem-node \
zdharma-continuum/zinit-annex-patch-dl
## Zinit Snippets
### load Oh My ZSH plugins
omz_plugins=(
git
tmux
gitignore
cp
colored-man-pages
)
for plugin in ${omz_plugins[@]}; do
zinit snippet OMZ::plugins/$plugin/$plugin.plugin.zsh
done
zinit snippet OMZ::lib/key-bindings.zsh
zinit snippet OMZ::lib/history.zsh
### load other zinit plugins
zinit load zdharma-continuum/history-search-multi-word
zinit light zsh-users/zsh-autosuggestions
zinit light zdharma-continuum/fast-syntax-highlighting
# zinit pyenv
zinit light mattberther/zsh-pyenv
## Language
export LANG=zh_CN.UTF-8
export LC_MESSAGES="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
## Alias
alias aria="aria2c -s 16 -x 16"
alias ls="ls -G"
## Key Binding
### Support up/down line for search
bindkey '^[[A' up-line-or-search
bindkey '^[[B' down-line-or-search
## Zstyle
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}'
## Functions
### macOS setting up
if [ `uname` = "Darwin" ]; then
## sysatem updated
update() {
brew upgrade
curl $CASK_LIVECHECK_GIST_RAW_URL --output ~/.brew_livecheck_watchlist
brew list --casks -1 | grep -F -f ~/.brew_livecheck_watchlist | sort | uniq | awk '{print "Start upgrade "$1 ;system("brew upgrade --greedy "$1)}'
}
export EDITOR="code -w"
## DNS Clean up
alias dnsclean="sudo killall -HUP mDNSResponder; sleep 2; echo DNS Cache Reset"
fi
## Golang
if ! command -v go &> /dev/null ; then
export GO111MODULE=on
export GOPATH=$HOME/go
export GOBIN=$HOME/go/bin
export PATH="$PATH:$GOBIN"
fi
## Docker
if ! command -v docker &> /dev/null ; then
zinit ice as"program" from"gh-r" mv"docker-c* -> docker-compose"
zinit light docker/compose
fi
## Python
if ! command -v python &> /dev/null ; then
zinit light pyenv/pyenv
fi
## Node
### N
if [ -d $HOME/.n ]; then
export N_PREFIX=$HOME/.n
export PATH=$PATH:$N_PREFIX/bin
fi
## Ruby
if [ -d $HOME/.rvm ]; then
export PATH="$PATH:$HOME/.rvm/bin"
fi
## direnv
zinit ice as"program" make'!' atclone'./direnv hook zsh > zhook.zsh' \
atpull'%atclone' pick"direnv" src"zhook.zsh"
zinit light direnv/direnv
## GCP
if [ `uname` = "Darwin" ]; then
source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc"
fi
## Chezmoi
alias cz='chezmoi'
source ~/.config/chezmoi/completion.zsh
## GPG
export GPG_TTY=$(tty)
## ZSH theme
### Load starship theme via zinit
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