-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
167 lines (132 loc) · 3.87 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
# Lines configured by zsh-newuser-install
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '$HOME/.zshrc'
# fix for Mac
PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"
MANPATH="/opt/homebrew/opt/coreutils/libexec/gnuman:$MANPATH"
autoload -Uz compinit promptinit vcs_info
compinit
promptinit
zstyle ':completion:*' rehash true
zstyle ':completion:*' menu select
setopt menu_complete
# End of lines added by compinstall
#zsh histoty
SAVEHIST=50000
HISTSIZE=$SAVEHIST
HISTFILE=~/.zsh_history
setopt inc_append_history
setopt share_history
#zsh
setopt HIST_IGNORE_DUPS
setopt autocd correct
bindkey -e # must at first
autoload -z edit-command-line
zle -N edit-command-line
bindkey "^X^E" edit-command-line
ZSH_AUTOSUGGEST_STRATEGY=(match_prev_cmd history completion)
#git
zstyle ':vcs_info:*' enable git
precmd() {
vcs_info
}
setopt prompt_subst
#display
export PS1="%F{6}%n%f%F{1}@%f%F{8}%m%f%F{3}>%f"
gitPrefix="%F{1}%r/%S%f %F{4}%b%f"
zstyle ':vcs_info:git*' formats "$gitPrefix"
zstyle ':vcs_info:git*' actionformats "$gitPrefix (%a)"
zstyle ':vcs_info:*' nvcsformats "%F{2}%~%f"
RPROMPT='${vcs_info_msg_0_}'
#vim
export EDITOR=vim
alias vim="stty stop '' -ixoff; vim"
#antigen
source ~/.antigen/antigen.zsh
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-autosuggestions
antigen apply
#color
zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)(?)*==01=02}:${(s.:.)LS_COLORS}")'
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
#mingw
alias mingw-gcc=i686-w64-mingw32-gcc
alias mingw-g++=i686-w64-mingw32-g++
#keybinds
bindkey "${terminfo[khome]}" beginning-of-line
bindkey "${terminfo[kend]}" end-of-line
bindkey "${terminfo[kdch1]}" delete-char
if [[ $TERM == xterm-termite ]]; then
. /etc/profile.d/vte.sh
__vte_osc7
fi
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
bindkey "^[[1;5D" backward-word
bindkey "^[[1;5C" forward-word
# unix tools
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias dmesg='dmesg --color=always'
# if not on mac
if [[ $OSTYPE != darwin* ]]; then
alias diff='diff --color=auto'
fi
export LESS=-R
export LESS_TERMCAP_mb=$'\E[1;31m' # begin bold
export LESS_TERMCAP_md=$'\E[1;36m' # begin blink
export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
export LESS_TERMCAP_so=$'\E[01;44;33m' # begin reverse video
export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
export LESS_TERMCAP_ue=$'\E[0m' # reset underline
# home bin
export PATH=~/bin:~/.local/bin:$PATH
# git-summary
alias git-summary='~/.git-summary/git-summary'
# tty clock
alias tty-clock="tty-clock -c -C4"
alias pacsyu="sudo pacman -Syu; pacaur -Syu"
# menu vim keybind
zmodload zsh/complist
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
# note: use ctrl + f intead right key
# caps lock
alias caps_lock="xdotool key Caps_Lock"
# autojump
if [[ "$OSTYPE" == "darwin"* ]]; then
autojump_path=/opt/homebrew/etc/profile.d/autojump.sh
else
autojump_path=/etc/profile.d/autojump.sh
fi
[ -f $autojump_path ] && . $autojump_path
# ruby
export PATH=$PATH:$(ruby -e 'print Gem.user_dir')/bin
# google depot-tools
export PATH=$PATH:/opt/depot_tools
# thefuck
if [ -x "$(command -v thefuck)" ]; then
eval $(thefuck --alias)
fi
alias cd-tmp='cd $(mktemp -d)'
# set git english
alias git='LANG=en_US git'
case "$OSTYPE" in
linux*)
# check $DISPLAY, if not set then set it to :0
if [ -z "$DISPLAY" ]; then
export DISPLAY=:0
fi
;;
esac
# set up neovim
# check `nvim` is installed then set alias
if [ -x "$(command -v nvim)" ]; then
# alias vim=nvim
alias nvi=nvim
fi
export XDG_CONFIG_HOME="$HOME/.config"