-
Notifications
You must be signed in to change notification settings - Fork 4
/
.zshrc
183 lines (160 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
#------------------------------------------------------------------zplug-------------------------------------------------------------------------{
zmodload zsh/zprof
zmodload zsh/complist
source $HOME/.profile
source $HOME/.zplug/init.zsh
DIRSTACKSIZE=99
HISTORY_BASE=$HOME/tmp/.directory_history/
[[ "$TERM" =~ "screen" ]] && POWERLEVEL9K_MODE='awesome-fontconfig'
POWERLEVEL9K_OS_ICON_BACKGROUND='white'
POWERLEVEL9K_OS_ICON_FOREGROUND='blue'
POWERLEVEL9K_VI_MODE_INSERT_BACKGROUND='green'
POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND='000'
POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND='yellow'
POWERLEVEL9K_VI_MODE_NORMAL_FOREGROUND='000'
POWERLEVEL9K_HOME_ICON=""
POWERLEVEL9K_LINUX_ICON=""
POWERLEVEL9K_VCS_GIT_ICON=""
POWERLEVEL9K_VI_INSERT_MODE_STRING="✎"
POWERLEVEL9K_VI_COMMAND_MODE_STRING=""
zplug "lib/directory", from:oh-my-zsh
zplug "lib/history", from:oh-my-zsh
zplug "plugins/archlinux", from:oh-my-zsh
zplug "plugins/dirpersist", from:oh-my-zsh
zplug "plugins/extract", from:oh-my-zsh
zplug "plugins/fbterm", from:oh-my-zsh
zplug "plugins/git-extras", from:oh-my-zsh
zplug "plugins/nmap", from:oh-my-zsh
zplug "plugins/pip", from:oh-my-zsh
zplug "plugins/per-directory-history", from:oh-my-zsh
zplug "blindFS/zsh-funcs"
zplug "zsh-users/zsh-syntax-highlighting", nice:10
zplug "zsh-users/zsh-history-substring-search", nice:19
zplug "hlissner/zsh-autopair", nice:19
zplug "b4b4r07/enhancd", use:init.sh
zplug "jimmijj/chromatic-zsh", use:"{config.zsh,completion.zsh}", nice:19
zplug "bhilburn/powerlevel9k", use:powerlevel9k.zsh-theme
# zplug "zsh-users/zsh-completions"
if ! zplug check --verbose; then
printf "Install? [y/N]: "
if read -q; then
echo; zplug install
fi
fi
if zplug check b4b4r07/enhancd; then
ENHANCD_DIR=$HOME/tmp/.enhancd/
ENHANCD_FILTER=fzf
ENHANCD_DISABLE_HOME=1
fi
if zplug check zsh-users/zsh-syntax-highlighting; then
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue'
ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=green'
ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=yellow'
fi
zplug load
compinit
#--------------------------------------------------------------------------------------------------------------------------------------------------}
#------------------------------------------------------------------options-------------------------------------------------------------------------{
unsetopt correct_all
unsetopt menu_complete
unsetopt flowcontrol
setopt inc_append_history
setopt hist_ignore_dups
setopt extended_history
setopt auto_pushd
setopt pushd_ignore_dups
setopt auto_list
setopt auto_menu
setopt hist_ignore_space
setopt interactive_comments
setopt auto_cd
setopt complete_in_word
setopt promptpercent
setopt promptsubst
limit coredumpsize 0
#--------------------------------------------------------------------------------------------------------------------------------------------------}
#------------------------------------------------------------------keybind-------------------------------------------------------------------------{
bindkey -v
bindkey -M vicmd 'gh' vi-beginning-of-line
bindkey -M vicmd 'gl' vi-end-of-line
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
bindkey -M vicmd 'u' undo
bindkey -M vicmd '^R' redo
bindkey -M viins '^K' kill-line
bindkey -M viins '^B' backward-word
bindkey -M viins '^F' forward-word
bindkey -M viins '^A' beginning-of-line
bindkey -M viins '^E' end-of-line
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
FZF_TMUX=-1
bindkey '^T' fzf-file-widget
bindkey '^Z' fzf-ds-widget
bindkey '^H' fzf-history-widget
# bindkey '^I' fzf-completion
bindkey '^N' history-search-forward
bindkey '^P' history-search-backward
#--------------------------------------------------------------------------------------------------------------------------------------------------}
#--------------------------------------------------------------------misc--------------------------------------------------------------------------{
# for wildcards
setopt GLOB_COMPLETE
zle -C complete-glob menu-complete compglob
compglob () {
setopt localoptions globsubst
compset -P '*'
files=(${IPREFIX}*)
display=(${files/${IPREFIX}/${(q)IPREFIX}})
glob=(${files/${IPREFIX}/})
compadd -d display -- $glob
}
bindkey "^O" complete-glob
sudo-command-line() {
[[ -z $BUFFER ]] && zle up-history
[[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER"
zle end-of-line
}
zle -N sudo-command-line
bindkey '^R' sudo-command-line
#--------------------------------------------------------------------------------------------------------------------------------------------------}
#------------------------------------------------------------------alias---------------------------------------------------------------------------{
### universal
alias java_proxy='JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=localhost -Dhttp.proxyPort=8123 "'
alias cp='cp -i'
alias mv='mv -i'
alias pcp='rsync -aP'
alias mkdir='mkdir -p'
alias rm='rm -i'
alias vims='vim --servername VIM'
alias vimr='vim --remote'
alias aria2-rpc='cd ~/Downloads && aria2c --enable-rpc --rpc-listen-all&'
alias von='sudo vbetool dpms on'
alias voff='sudo vbetool dpms off'
alias jp2a='jp2a --color'
alias grep='grep --color=auto'
alias ll='ls -alF --color=auto'
alias ls='ls --color=auto'
alias du='du --max-depth=1 -h'
alias xopen='xdg-open'
alias cl='clear'
alias ccat='pygmentize -g'
alias bbs='luit -encoding gbk telnet bbs.ustc.edu.cn'
alias externalip='curl icanhazip.com'
alias reboot='sudo reboot'
alias systemctl='sudo systemctl'
alias halt='sudo halt'
alias tcpdump='sudo tcpdump -i any'
alias top10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
#--------------------------------------------------------------------------------------------------------------------------------------------------}
#------------------------------------------------------------------prompt--------------------------------------------------------------------------{
if [[ $TERM == "linux" ]]; then
export DISPLAY=:0
TERM=fbterm
eval `dircolors ~/.dircolors-fbterm`
fi
#--------------------------------------------------------------------------------------------------------------------------------------------------}
# vim:ts=4:sw=4:tw=0:ft=zsh:fdm=marker:fdl=0