-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
221 lines (196 loc) · 4.82 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
#### Initialize
zcompile $HOME/.zshrc
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export TERM=xterm-256color
export WORDCHARS='~!#$%^&()_[]{}<>?'
source $HOME/.zsh.d/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
### Autoload
autoload -Uz add-zsh-hook
autoload -Uz colors; colors
autoload -Uz compinit; compinit
autoload -Uz promptinit; promptinit
autoload -Uz vcs_info
### General
bindkey -e
setopt always_last_prompt
unsetopt auto_cd
setopt auto_list
setopt auto_menu
setopt auto_name_dirs
setopt auto_param_slash
setopt auto_param_keys
setopt auto_pushd
unsetopt auto_remove_slash
setopt auto_resume
setopt brace_ccl
setopt bsd_echo
setopt cdable_vars
setopt complete_in_word
unsetopt correct
unsetopt correct_all
setopt extended_glob
setopt function_argzero
setopt hash_cmds
setopt ignoreeof
setopt list_packed
setopt list_types
setopt long_list_jobs
setopt magic_equal_subst
setopt mark_dirs
setopt multios
setopt no_beep
setopt no_clobber
setopt no_flow_control
setopt no_hup
setopt no_menu_complete
setopt notify
setopt numeric_glob_sort
setopt path_dirs
setopt print_eight_bit
setopt prompt_subst
setopt pushd_ignore_dups
setopt pushd_to_home
setopt pushd_silent
setopt short_loops
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:*' use-cache true
zstyle ':completion:*:default' menu select=1
zstyle ':completion:*:processes' command 'ps aux'
### History
HISTFILE=$HOME/.zhistory
HISTSIZE=1000
SAVEHIST=10000
setopt append_history
setopt extended_history
setopt hist_expand
setopt hist_find_no_dups
setopt hist_ignore_all_dups
setopt hist_ignore_dups
setopt hist_ignore_space
setopt hist_no_functions
setopt hist_no_store
setopt hist_reduce_blanks
setopt hist_save_no_dups
setopt inc_append_history
setopt share_history
### VCS
if type git > /dev/null 2>&1; then
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' actionformats '(%s)-[%b]' '%m' '<!%a>'
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' formats '(%s)-[%b]' '%m'
zstyle ':vcs_info:*' get-revision true
zstyle ':vcs_info:*' max-exports 3
zstyle ':vcs_info:git:*' actionformats '(%s)-[%b]' '%c%u %m' '<!%a>'
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' formats '(%s)-[%b]' '%c%u'
zstyle ':vcs_info:git:*' get-revision true
zstyle ':vcs_info:git:*' stagedstr '+'
zstyle ':vcs_info:git:*' unstagedstr '-'
function _precmd_vcs_info () {
psvar=()
LANG=en_US.UTF-8 vcs_info
if [[ -z ${vcs_info_msg_0_} ]]; then
psvar[1]=""
psvar[2]=""
psvar[3]=""
else
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]=( "${vcs_info_msg_0_}" )
[[ -n "$vcs_info_msg_1_" ]] && psvar[2]=( "${vcs_info_msg_1_}" )
[[ -n "$vcs_info_msg_2_" ]] && psvar[3]=( "${vcs_info_msg_2_}" )
fi
}
add-zsh-hook precmd _precmd_vcs_info
fi
### Functions
if type peco > /dev/null 2>&1; then
function peco_select_history() {
typeset tac
if which tac > /dev/null; then
tac=tac
else
tac='tail -r'
fi
BUFFER=$(fc -l -n 1 | eval $tac | peco --query "$LBUFFER")
CURSOR=$#BUFFER
zle redisplay
}
zle -N peco_select_history
bindkey '^r' peco_select_history
fi
### Variables
# EDITOR
export EDITOR="vi"
# PAGER
export PAGER="less"
export LESS="--RAW-CONTROL-CHARS"
# PATH
typeset -U path PATH
typeset -U manpath MANPATH
path=( \
$HOME/opt/bin \
/usr/local/sbin \
/usr/local/bin \
/usr/sbin \
/usr/bin \
/sbin \
/bin \
)
# REPORTTIME
export REPORTTIME=5
# cargo
if [ -e $HOME/.cargo ]; then
export PATH="$HOME/.cargo/bin:$PATH"
fi
# go
if [ -e $HOME/go ]; then
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH
#export PATH=$GOPATH/bin:/opt/go/bin:$PATH
fi
# nodenv
if [ -e $HOME/.nodenv ]; then
export PATH="$HOME/.nodenv/bin:$PATH"
eval "$(nodenv init -)"
fi
# plenv
if [ -e $HOME/.plenv ]; then
export PATH="$HOME/.plenv/bin:$PATH"
eval "$(plenv init - zsh)"
fi
# pyenv
if [ -e $HOME/.pyenv ]; then
export PYENV_ROOT=$HOME/.pyenv
export PATH=$PYENV_ROOT/bin:$PATH
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
fi
# rbenv
if [ -e $HOME/.rbenv ]; then
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
fi
### Aliases
alias be='bundle exec'
alias bt='batcat --color=always --paging=never --style="changes,numbers,snip" --theme=GitHub'
alias e='exit'
alias dcb='docker-compose build'
alias dcd='docker-compose down'
alias dce='docker-compose exec'
alias dcu='docker-compose up'
alias dcp='docker-compose ps'
alias dcr='docker-compose run --rm'
alias doe='docker exec -it'
alias doi='docker image'
alias dois='docker images'
alias dop='docker ps'
alias dopa='docker ps -a'
alias nv='nvim'
alias t='tmux -f ~/.tmux.conf'
alias v='vim'
### Environment settings
if [ -e $HOME/.zshrc.env ]; then
source $HOME/.zshrc.env
fi
# export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0