-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
171 lines (155 loc) · 4.28 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
#------------------------------
# Reference
# https://wiki.archlinux.org/index.php/Zsh
# https://github.com/MrElendig/dotfiles-alice/blob/master/.zshrc
#------------------------------
#------------------------------
# History
#------------------------------
HISTFILE=~/.zsh_history
HISTSIZE=100000
SAVEHIST=100000
# http://zsh.sourceforge.net/Doc/Release/Options.html#History
setopt BANG_HIST
setopt EXTENDED_HISTORY
setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_FIND_NO_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_SAVE_NO_DUPS
setopt HIST_REDUCE_BLANKS
setopt HIST_VERIFY
setopt HIST_BEEP
#------------------------------
# Variables
#------------------------------
export ARCHFLAGS="-arch x86_64"
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# Set CLICOLOR if you want Ansi Colors in iTerm2
# export CLICOLOR=1
# Set colors to match iTerm2 Terminal Colors
# export TERM=xterm-256color
export EDITOR=vim
export PATH=/usr/local/bin:$PATH
# opt out Homebrew analytics
# https://github.com/Homebrew/brew/blob/master/docs/Analytics.md
# export HOMEBREW_NO_ANALYTICS=1
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:~/.cargo/bin
export RUST_SRC_PATH=$(rustc --print sysroot)/lib/rustlib/src/rust/src
#-----------------------------
# Dircolors
#-----------------------------
LS_COLORS='rs=0:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:';
export LS_COLORS
#-----------------------------
# Keybindings
#-----------------------------
bindkey -e
#------------------------------
# Alias
#------------------------------
alias ls="ls -F"
alias ll="ls -hl"
alias la="ls -aF"
alias ta="tmux attach"
alias i3lock='i3lock -c 000000'
#------------------------------
# ShellFuncs
#------------------------------
# -- coloured manuals
man() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
man "$@"
}
#------------------------------
# Comp stuff
#------------------------------
fpath=(/usr/local/share/zsh/site-functions $fpath)
# rustup completion
# $ rustup completions zsh > ~/.zfunc/_rustup
fpath+=~/.zfunc
zmodload zsh/complist
autoload -Uz compinit
compinit
# match uppercase from lowercase
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
#------------------------------
# Window title
#------------------------------
case $TERM in
termite|*xterm*|rxvt|rxvt-unicode|rxvt-256color|rxvt-unicode-256color|(dt|k|E)term)
precmd () {
vcs_info
print -Pn "\e]0;[%n@%M][%~]%#\a"
}
preexec () { print -Pn "\e]0;[%n@%M][%~]%# ($1)\a" }
;;
screen|screen-256color)
precmd () {
vcs_info
print -Pn "\e]83;title \"$1\"\a"
print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~]\a"
}
preexec () {
print -Pn "\e]83;title \"$1\"\a"
print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~] ($1)\a"
}
;;
esac
#------------------------------
# Prompt
#------------------------------
autoload -U colors zsh/terminfo
colors
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git hg
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:git*' formats "%{${fg[cyan]}%}[%{${fg[green]}%}%s%{${fg[cyan]}%}][%{${fg[blue]}%}%r/%S%%{${fg[cyan]}%}][%{${fg[blue]}%}%b%{${fg[yellow]}%}%m%u%c%{${fg[cyan]}%}]%{$reset_color%}"
setprompt() {
setopt prompt_subst
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
p_host='%F{yellow}%M%f'
else
p_host='%F{green}%M%f'
fi
PS1=${(j::Q)${(Z:Cn:):-$'
%F{cyan}[%f
%(!.%F{red}%n%f.%F{green}%n%f)
%F{cyan}@%f
${p_host}
%F{cyan}][%f
%F{blue}%~%f
%F{cyan}]%f
%(!.%F{red}%#%f.%F{green}%#%f)
" "
'}}
PS2=$'%_>'
RPROMPT=$'${vcs_info_msg_0_}'
}
setprompt
#------------------------------
# misc
#------------------------------
# load fzf
# [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
source /usr/share/fzf/key-bindings.zsh
source /usr/share/fzf/completion.zsh
# load private settings
test -f ~/.zshrc.priv && source ~/.zshrc.priv
# Google translate
d () {
trans -d $1 | less -R
}