forked from seagle0128/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc.local
142 lines (117 loc) · 4.47 KB
/
.zshrc.local
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
# Local configurations -*- mode: sh -*-
# Show system information
if command -v neofetch >/dev/null 2>&1; then
neofetch
fi
# Plugins
# antigen bundle docker
# antigen bundle docker-compose
# antigen bundle docker-machine
# antigen bundle golang
# antigen bundle python
# antigen bundle ruby
# antigen bundle archlinux
# antigen bundle ubuntu
# Theme
if [ -n "$INSIDE_EMACS" ]; then
DISABLE_AUTO_TITLE="true"
# antigen theme dst # ys, dst, wedisagree, robbyrussell
else
# antigen theme steeef # ys, dst, steeef, wedisagree, robbyrussell
# antigen theme danihodovic/steeef
# antigen theme seagle0128/bullet-train.zsh
# antigen theme simnalamburt/shellder
# antigen theme denysdovhan/spaceship-prompt spaceship
# Powerful theme (require powerline fonts)
# cargo install powerline-rs
# go get -u github.com/justjanne/powerline-go
function powerline_precmd() {
if command -v powerline-rs >/dev/null 2>&1; then
PS1="$(powerline-rs --shell zsh $?)"
elif command -v powerline-go >/dev/null 2>&1; then
PS1="$(powerline-go -error $? -shell zsh)"
fi
}
function install_powerline_precmd() {
for s in "${precmd_functions[@]}"; do
if [ "$s" = "powerline_precmd" ]; then
return
fi
done
precmd_functions+=(powerline_precmd)
}
if [ "$TERM" != "linux" ]; then
install_powerline_precmd
fi
fi
# Env
# export EDITOR=vim
# export PYTHONPATH=/usr/local/lib/python2.7/site-packages
# Aliases
# alias upgrade_go='$DOTFILES/install_go.sh'
# Proxy
PROXY=http://127.0.0.1:1087
PROXY2=http://127.0.0.1:8123
SOCK_PROXY=socks5://127.0.0.1:1086
NO_PROXY=10.*.*.*,192.168.*.*,*.local,localhost,127.0.0.1
alias set_polipo_proxy='ps -ef | grep polipo | grep -v grep; [ $? -ne 0 ] && polipo socksParentProxy=192.168.31.1:1082 &'
alias showproxy='echo "proxy=$http_proxy"'
alias setproxy='export http_proxy=$PROXY; export https_proxy=$PROXY; export no_proxy=$NO_PROXY; showproxy'
alias setproxy2='set_polipo_proxy; export http_proxy=$PROXY2; export https_proxy=$PROXY2; export no_proxy=$NO_PROXY; showproxy'
alias unsetproxy='export http_proxy=; export https_proxy=; export no_proxy=; showproxy'
alias unsetproxy2='killall polipo;unsetproxy'
alias toggleproxy='if [ -n "$http_proxy" ]; then unsetproxy; else setproxy; fi'
alias toggleproxy2='if [ -n "$http_proxy" ]; then unsetproxy2; else setproxy2; fi'
alias set_sock_proxy='export http_proxy=$SOCK_PROXY; export https_proxy=$SOCK_PROXY; export no_proxy=$NO_PROXY; showproxy'
alias unset_sock_proxy=unsetproxy
alias toggle_sock_proxy='if [ -n "$http_proxy" ]; then unset_sock_proxy; else set_sock_proxy; fi'
# Homebrew
if [[ $OSTYPE == darwin* ]]; then
# export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
function set_homebrew_mirror() {
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd - >/dev/null
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
cd - >/dev/null
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
cd - >/dev/null
brew update
}
function reset_homebrew() {
export HOMEBREW_BOTTLE_DOMAIN=
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
cd - >/dev/null
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
cd - >/dev/null
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://github.com/Homebrew/homebrew-cask
cd - >/dev/null
brew update
}
fi
# Golang
if command -v go >/dev/null 2>&1; then
export GOPROXY=https://athens.azurefd.net/
function gocomplete() {
antigen bundle golang
}
function goclean() {
go clean -i -n $1
go clean -i $1
rm -rf $GOPATH/src/$1
if [ -d $GOPATH/pkg/${sysOS:l}_amd64/$1 ]; then
rm -rf $GOPATH/pkg/${sysOS:l}_amd64/$1;
fi
}
function goclean_test() {
go clean -i -n $1
tree -L 1 $GOPATH/src/$1
tree -L 1 $GOPATH/pkg/${sysOS:l}_amd64/$1
}
fi