-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaliases.sh
103 lines (93 loc) · 3.05 KB
/
aliases.sh
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
export GREP_COLOR='1;31'
###
# @Author: lpdswing
# @Date: 2020-11-06 15:40:19
# @LastEditTime: 2021-02-20 15:24:39
# @LastEditors: Please set LastEditors
# @Description: In User Settings Edit
# @FilePath: /.rc.d/aliases.sh
###
export LC_ALL="zh_CN.UTF-8"
if [ `uname` = "Darwin" ]; then
export PATH="/usr/local/sbin:$PATH"
fi
if [ -d $HOME/.local/bin ]; then
export PATH="$HOME/.local/bin:$PATH"
fi
# Custom alias
alias l='ls -Clho'
alias ll='ls -ClhF'
alias la='ls -A'
alias lla='ls -ClhFA'
alias rs='rsync -cvrzP --exclude={.git,.hg,.svn,.venv,.DS_Store}'
alias httpserver='python -m SimpleHTTPServer'
alias httpserver3='python -m http.server'
alias grep='grep -I --color=auto --exclude-dir={.git,.hg,.svn,.venv}'
alias psgrep='ps ax|grep -v grep|grep'
alias tree='tree -C --dirsfirst'
alias less='less -N'
alias aria='aria2c -c -x 16 --file-allocation=none'
alias axel='axel -n 30'
alias ping='ping -i 0.5 -c 10'
alias vnccnt='netstat -nat|grep -w 5900|grep -c ESTABLISHED '
# macOS alias
if [ `uname` = "Darwin" ]; then
export HOMEBREW_NO_AUTO_UPDATE=true # disable homebrew auto update
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.aliyun.com/homebrew/homebrew-bottles"
alias tailf='tail -F'
alias rmds='find . -type f -name .DS_Store -delete'
alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
alias power="echo Power: $(pmset -g batt|awk 'NR==2{print $3}'|sed 's/;//g')"
alias clsattr="xattr -lr ."
alias tree='tree -N'
fi
# Python alias
alias py='python'
alias py2='python2'
alias py3='python3'
alias ipy='ipython'
alias ipy2='ipython2'
alias ipy3='ipython3'
alias venv='python -m venv'
alias virtualenv='python -m venv'
alias jpy='jupyter notebook'
alias pep='pycodestyle --ignore=E501'
alias rmpyc='find . | grep -wE "py[co]|__pycache__" | xargs rm -rvf'
alias pygrep='grep --include="*.py"'
if [[ $plugins =~ 'pip' ]]; then
unalias pip
fi
# Git alias
alias gst='git status -sb'
alias gstt='git status'
alias gdf='git difftool'
alias glg="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias gco='git checkout'
alias gmg='git merge --no-commit --squash' # merge不产生新commit,并且可以多个commit合并为一个
# brew
if [[ `uname` = "Darwin" ]]; then
if which brew > /dev/null; then
# BREWHOME=`brew --prefix`
BREWHOME="/usr/local"
export LDFLAGS="-L$BREWHOME/lib"
export CPPFLAGS="-I$BREWHOME/include"
export PKG_CONFIG_PATH="$BREWHOME/lib/pkgconfig"
fi
fi
# Pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if which pyenv > /dev/null; then
eval "$(pyenv init -)";
# eval "$(pyenv virtualenv-init -)"
# pyenv alias
alias pyv='pyenv versions'
alias chpy='pyenv global'
alias chlpy='pyenv local'
alias chgpy='pyenv global'
fi
# golang
if [[ `uname` = "Linux" ]]; then
export PATH=$PATH:/usr/local/go/bin
fi