-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
142 lines (124 loc) · 4.43 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
export TOOLCHAINS=swift
# Add tmux config
export PATH=$HOME/local/bin:$PATH
export LD_LIBRARY_PATH=$HOME/local/lib:$LD_LIBRARY_PATH
export MANPATH=$HOME/local/share/man:$MANPATH
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
#lanio is a very good boy
#
export PYENV_ROOT=/Users/freedragon/.pyenv/
export PATH="$PATH:$HOME/.rvm/bin"
#pyenv fix无效 pyenv global 3.7.5
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
export TERM=xterm-256color
# My useful aliases
alias vim='nvim'
alias vi='nvim'
alias VI='nvim'
alias VIM='nvim'
alias Vi='nvim'
alias vI='nvim'
alias Vim='nvim'
alias VIm='nvim'
alias viM='nvim'
alias ViM='nvim'
#alias vIm='nvim'
#alias en="trans -e google -b :en"
#alias zh="trans -e google -b :zh-CN"
#alias en="trans -b :en"
#alias zh="trans -b :zh-CN"
alias rm="trash"
alias ldu="ls -1 | xargs du -h -d 0 2>/dev/null"
alias music="you-get -o /Users/freedragon/Music/Chinese -O "
alias clean="tmux kill-session -t 0"
ZSH_THEME="agnoster"
plugins=(zsh-autosuggestions git)
source /usr/local/Cellar/zsh-syntax-highlighting/0.6.0/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
export LC_ALL=en_US.UTF-8
export PATH=${PATH}:/Users/freedragon/Library/Android/sdk/platform-tools
export PATH=${PATH}:/Users/freedragon/Library/Android/sdk/tools
export PATH="/usr/local/opt/sqlite/bin:$PATH"
export PATH="/usr/local/opt/openssl/bin:$PATH"
export HOMEBREW_NO_AUTO_UPDATE=true
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
#function proxy_off(){
# unset no_proxy
# unset http_proxy
# unset https_proxy
# ps -ef | grep V2Milk | grep -v grep | awk '{print $2}' | xargs kill
# echo -e "已关闭代理"
#}
#
#function proxy_on() {
# open /Applications/弄子里.app
# export no_proxy="localhost,127.0.0.1,localaddress.localdomain.com"
# export http_proxy="http://127.0.0.1:8001"
# export https_proxy="https://127.0.0.1:8001"
# echo -e "已开启代理"
#}
#if brew list | grep coreutils > /dev/null ; then
# PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH"
# alias ls='ls -F --show-control-chars --color=auto'
# eval 'gdircolors -b $HOME/.dir_colors'
#fi
##afplay##start##
function m() {
music_by_keyword $1 &
}
function music_by_keyword() {
m_path=~/Music/Chinese/
keyword="." # default: play all the songs
if [ -n "$1" ]; then # play songs by keyword
keyword="$1"
fi
song_num="$(ls $m_path | grep -i -e $keyword | wc -l)" # Total num of qualified songs
while [ 1 ]
do
dummy1=$((RANDOM))
timestamp=$(date +%s)
dummy=$(($dummy1*$timestamp))
song_index=$(($dummy1%$song_num+1)) # Generate a random song index
song="$(ls $m_path | grep -i -e $keyword | sed -n "$song_index"p)" # Get the name of the qualified song
echo -e "$song"
afplay "$m_path$song"
wait``
done
}
function ml() {
keyword="."
if [ -n "$1" ]; then
keyword=$1
fi
m_path=~/Music/Chinese/
list=$(ls $m_path | grep -i -e $keyword)
echo -e "$list"
}
function mn() { # next song
pid="$(ps -ef | grep afplay | grep -v grep | head -1 | awk '{print $2}')"
kill -INT $pid
}
function me() { # terminate afplay
pid="$(ps -ef | grep afplay | grep -v grep | head -1 | awk '{print $2}')"
ppid="$(ps -ef | grep afplay | grep -v grep | head -1 | awk '{print $3}')"
kill -INT $ppid && kill -INT $pid
}
function ms() { # music stop
ppid="$(ps -ef | grep afplay | grep -v grep | head -1 | awk '{print $3}')"
pid="$(ps -ef | grep afplay | grep -v grep | head -1 | awk '{print $2}')"
kill -TSTP $pid && kill -TSTP $ppid
}
function mc() { # music continue
ppid="$(ps -ef | grep afplay | grep -v grep | head -1 | awk '{print $3}')"
pid="$(ps -ef | grep afplay | grep -v grep | head -1 | awk '{print $2}')"
kill -CONT $pid && kill -CONT $ppid
}
function over(){ #over vpn
# ps -ef | grep nsurlsessiond | grep -v grep | awk '{print $2}' | xargs kill
ps -ef | grep $1 | grep -v grep | awk '{print $2}' | xargs kill
# ps -ef | grep nsurlstoraged | grep -v grep | awk '{print $2}' | xargs kill
}
##afplay##end##
alias config='/usr/bin/git --git-dir=/Users/freedragon/.cfg/ --work-tree=/Users/freedragon'
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
#ZSH_THEME="powerlevel9k/powerlevel9k"