-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdot_zshrc
112 lines (95 loc) · 2.74 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
export TERM="xterm-256color"
eval `dircolors ~/.dircolors`
# oh-my-zsh
ZSH=~/.oh-my-zsh
ZSH_THEME="qupeng"
DISABLE_AUTO_UPDATE="true"
CASE_SENSITIVE="true"
ZSH_CACHE_DIR=$HOME/.oh-my-zsh-cache
[ ! -d $ZSH_CACHE_DIR ] && mkdir $ZSH_CACHE_DIR
plugins=(zsh-completions zsh-syntax-highlighting rust git)
source $ZSH/oh-my-zsh.sh
unsetopt AUTO_CD # disable auto_cd when type dirname
autoload -U compinit
compinit
# key maps and alias
bindkey '^_[[Z' reverse-menu-complete
alias rm="rm -i"
alias ls="ls -h --color=auto"
alias ll="ls -l"
alias gg="exit"
alias vi="nvim"
alias vim="nvim"
alias sc="systemctl"
alias scu="systemctl --user"
alias gst="git status"
alias gbv="git branch -v"
alias gd="git diff"
alias gdn="git diff --name-only"
alias gdt="git difftool"
alias gdtn="git difftool --name-only"
alias tmux="tmux -u"
# general dev settings.
export CARGO_HOME=~/.cargo
export GOPATH=~/.go
local_bin=~/.local/bin
cargo_bin=~/.cargo/bin
go_bin=~/.go/bin
bins=($local_bin $cargo_bin $go_bin)
for bin in ${bins[@]}; do
[ ! -d $bin ] && mkdir -p $bin
if [ ! `echo $PATH|grep $bin` ]; then
export PATH=$bin:$PATH
fi
done
# for golang.
if [ ! `echo $PATH|grep ".local/opt/go/bin"` ]; then
export PATH=~/.local/opt/go/bin:$PATH
fi
# for mac os x.
if [ `uname` = "Darwin" ]; then
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
fi
lib_paths=("/usr/local/lib" "$HOME/.local/lib" "$HOME/.local/lib64")
for lib_path in ${lib_paths[@]}; do
if [ ! `echo $LD_LIBRARY_PATH|grep $lib_path` ]; then
export LD_LIBRARY_PATH=$lib_path:$LD_LIBRARY_PATH
export LIBRARY_PATH=$lib_path:$LIBRARY_PATH
fi
done
if [ ! `echo $C_INCLUDE_PATH|grep -E "$HOME/.local/include"` ]; then
export C_INCLUDE_PATH=$HOME/.local/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=$HOME/.local/include:$CPLUS_INCLUDE_PATH
fi
[ ! -d "$HOME/.local/share/man" ] && mkdir -p "$HOME/.local/share/man"
if [ ! `echo $MANPATH|grep -E "$HOME/.local/share/man"` ]; then
export MANPATH=$HOME/.local/share/man:$MANPATH
fi
pkgconfig_paths=("/usr/lib/pkgconfig" "/usr/local/lib/pkgconfig" "$HOME/.local/lib/pkgconfig")
for pkgconfig_path in ${pkgconfig_paths[@]}; do
if [ ! `echo $PKG_CONFIG_PATH|grep -E $pkgconfig_path` ]; then
export PKG_CONFIG_PATH=$pkgconfig_path:$PKG_CONFIG_PATH
fi
done
fg() {
if [ $# -eq 1 && $1 == - ]; then
builtin fg %-
else
builtin fg %"$@"
fi
}
bg() {
if [ $# -eq 1 && $1 == - ]; then
builtin bg %-
else
builtin bg %"$@"
fi
}
# tiup.
if [ ! `echo $PATH|grep tiup` ]; then
export PATH=$HOME/.tiup/bin:$PATH
fi
# fuck gcc
export CXXFLAGS='-Warray-bounds=0'
# source /opt/rh/devtoolset-8/enable