-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.zshrc.local
136 lines (110 loc) · 4.15 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
# Local configurations -*- mode: sh -*-
# Theme
# Load the pure theme, with zsh-async library that's bundled with it.
zinit ice depth"1" pick"async.zsh" src"pure.zsh"
zinit light sindresorhus/pure
# Load starship theme (requires nerd fonts)
# zinit ice as"program" wait lucid from"gh-r"
# zinit light starship/starship
# (( $+commands[starship] )) && eval $(starship init zsh)
# Plugins
# zinit wait lucid for \
# OMZP::python \
# OMZP::golang \
# OMZP::ruby \
# OMZP::rbenv \
# OMZP::rails \
# OMZP::rust
# zinit as"completion" wait lucid for \
# OMZP::docker/_docker \
# OMZP::rust/_rustc
# Show system information
# if (( $+commands[neofetch] )); then
# neofetch
# fi
# iTerm2 shell integration
# if test -e "${HOME}/.iterm2_shell_integration.zsh"; then
# source "${HOME}/.iterm2_shell_integration.zsh"
# fi
# For Emacs vterm
if [ -n "$INSIDE_EMACS" ]; then
DISABLE_AUTO_TITLE="true"
# ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=gray,underline'
# VTerm
if [[ "$INSIDE_EMACS" = 'vterm' ]]; then
function vterm_printf(){
if [ -n "$TMUX" ]; then
# tell tmux to pass the escape sequences through
# (Source: http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1324)
printf "\ePtmux;\e\e]%s\007\e\\" "$1"
elif [ "${TERM%%-*}" = "screen" ]; then
# GNU screen (screen, screen-256color, screen-256color-bce)
printf "\eP\e]%s\007\e\\" "$1"
else
printf "\e]%s\e\\" "$1"
fi
}
function vterm_prompt_end() {
vterm_printf "51;A$(whoami)@$(hostname):$(pwd)";
}
setopt PROMPT_SUBST
PROMPT=$PROMPT'%{$(vterm_prompt_end)%}'
alias clear='vterm_printf "51;Evterm-clear-scrollback";tput clear'
alias reset='vterm_printf "51;Evterm-clear-scrollback";tput clear'
fi
fi
# Env
# export EDITOR=vim
# PROXY=http://127.0.0.1:8001
# PROXY2=http://127.0.0.1:8123
# Aliases
# alias flush_dns='sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder'
# Homebrew
if [[ $OSTYPE == darwin* ]]; then
function set_homebrew_env()
{
# https://mirrors.ustc.edu.cn/
# https://mirrors.tnua.tsinghua.edu.cn/
export HOMEBREW_API_DOMAIN="https://mirrors.bfsu.edu.cn/homebrew-bottles/api"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.bfsu.edu.cn/homebrew-bottles"
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.bfsu.edu.cn/git/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.bfsu.edu.cn/git/homebrew/homebrew-core.git"
export HOMEBREW_PIP_INDEX_URL="https://mirrors.bfsu.edu.cn/pypi/web/simple"
}
function set_homebrew_mirror() {
set_homebrew_env
for tap in core cask{,-fonts,-versions} command-not-found services; do
brew tap --custom-remote --force-auto-update "homebrew/${tap}" "https://mirrors.bfsu.edu.cn/git/homebrew/homebrew-${tap}.git"
done
brew update
}
function reset_homebrew_env {
unset HOMEBREW_API_DOMAIN
unset HOMEBREW_BOTTLE_DOMAIN
unset HOMEBREW_BREW_GIT_REMOTE
unset HOMEBREW_CORE_GIT_REMOTE
unset HOMEBREW_PIP_INDEX_URL
}
function reset_homebrew_mirror() {
reset_homebrew_env
git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew
BREW_TAPS="$(BREW_TAPS="$(brew tap 2>/dev/null)"; echo -n "${BREW_TAPS//$'\n'/:}")"
for tap in core cask{,-fonts,-versions} command-not-found services; do
if [[ ":${BREW_TAPS}:" == *":homebrew/${tap}:"* ]]; then
brew tap --custom-remote "homebrew/${tap}" "https://github.com/Homebrew/homebrew-${tap}"
fi
done
brew update
}
# Use mirror env by default
set_homebrew_env
# For Apple Silicon CPU
[[ $CPUTYPE == arm* ]] && eval "$(/opt/homebrew/bin/brew shellenv)"
fi
# Golang
# Go Proxy
export GOPROXY=https://proxy.golang.com.cn,direct
# export GOPROXY=https://goproxy.cn,direct
# export GOPROXY=https://goproxy.io,direct
# Go Private
# export GOPRIVATE=