-
Notifications
You must be signed in to change notification settings - Fork 2
/
.zshrc
261 lines (232 loc) · 9.04 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# Path to your oh-my-zsh configuration.
DISABLE_AUTO_UPDATE=true
ZSH=/home/scl/.oh-my-zsh/
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="avit"
# ZSH_THEME="arrow"
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"
# Comment this out to disable weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"
# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment following line if you want red dots to be displayed while waiting for completion
COMPLETION_WAITING_DOTS="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(go golang pass bower git archlinux django github history history-substring-search mercurial)
# source /etc/profile
source $ZSH/oh-my-zsh.sh
# source /usr/bin/virtualenvwrapper.sh &>/dev/null
alias grep='grep --color=always -d skip'
alias open='xdg-open'
alias emacs='sudo emacs -nw'
alias pacman='sudo pacman'
alias xbps-install='sudo xbps-install'
alias systemctl='sudo systemctl'
alias service='sudo service'
alias mount='sudo mount'
alias umount='sudo umount'
alias sprunge="curl -F 'sprunge=<-' http://sprunge.us"
# tmux:
# -2 Force tmux to assume the terminal supports 256 colours.
# -u tmux attempts to guess if the terminal is likely to support
# UTF-8 by checking the first of the LC_ALL, LC_CTYPE and
# LANG environment variables to be set for the string
# "UTF-8". This is not always correct: the -u flag explicâ€
# itly informs tmux that UTF-8 is supported.
#
# If the server is started from a client passed -u or where
# UTF-8 is detected, the utf8 and status-utf8 options are
# enabled in the global window and session options respecâ€
# tively.
alias tmux='TERM=xterm-256color tmux -2 -u'
alias ta='tmux attach-session -t '
alias mkdir='mkdir -pv'
# function vim {
# PYTHONPATH=`python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"` /usr/bin/nvim "$@"
# }
alias vi=nvim
alias vim=nvim
alias svi='sudo nvim'
# activate a python virtualenv named venv in the current dir
alias activate='. ./venv/bin/activate'
# quit evilwm, could use ctrl-alt-backspace too
alias quit='kill $(ps ax|grep evilwm|grep -v grep|cut -d " " -f 2 )'
# show image -dir or file-
alias show='feh'
# share image on imgur
alias share='imgur'
# usefull to show program output in english
alias us='env LANG=en_US.UTF-8'
# laptop: asign control signal to caps-lock key
alias ctrlcaps='setxkbmap -option ctrl:swapcaps 2>/dev/null'
alias altswap='setxkbmap -option altwin:swap_alt_win 2>/dev/null'
alias compose="setxkbmap -option compose:ralt"
function laptop {
ctrlcaps
altswap
compose
}
function files {
if [ -z $1 ]
then
nohup dropbox start &
nohup seaf-cli start &
else
dropbox stop
seaf-cli stop
fi
}
# yes, that sounds tricky but this is the way to unset xkbmap options
alias unsetxkbmap='setxkbmap -option -option'
# full screen shot
alias shotall='scrot -z -c -d 2 ~/Pictures/%Y-%m-%d-%T-screenshot.png'
alias la='ls -a'
alias sudo="LD_PRELOAD= sudo"
alias man="LD_PRELOAD= man"
# alias emerge="sudo emerge"
alias ppython="ptipython --vi"
#alias fireflash="sudo chroot ~/arch /bin/su - scl -c `DISPLAY=:0 firefox`"
alias new_sql="touch $(date +%s).sql"
funcGoBinData() {
go-bindata -pkg $1 -o bindata.go db
}
alias sql_bindata=funcGoBinData
# hg alias
alias hgtree="hg --hidden log --graph --template '{rev}:{node|short} {branch} {desc|firstline}\n'"
function hgll {
hg log -G -p -r "topic($1)"
}
# git aliases
alias gittree="git log --graph --oneline --decorate --all"
alias gitlog="git log --oneline --decorate"
alias gitstatus="git status --short"
alias gitcleanbranches="git branch --merged | grep -v \"\*\" | grep -v master | grep -v dev | grep -v stable | xargs -n 1 git branch -d"
alias gitll="git log --oneline --decorate --numstat"
alias gitdiffc="git diff --cached"
alias gitdiff="git diff"
function gitfix {
git checkout master && git pull origin master && git fetch && git checkout origin/$1 && git checkout -b $1
}
function gitdeletebranch {
git branch -D $1
if [ -z $2 ]
then
git push origin --delete $1
else
git push $2 --delete $1
fi
}
# Docker aliases
function dockerclean_volumes {
for v in `docker volume ls -q`; do
if [[ $v =~ ^(leadme-postgres|dramarts-postgres|chaahk-postgres|criminocorpus_db|criminocorpus-postgres)$ ]]; then
echo "preserving $v"
else
docker volume rm $v
fi
done
}
function dockerrm {
docker rm -v $(docker ps -a -q -f status=exited)
}
function dockerrmi {
docker rmi $(docker images -f "dangling=true" -q)
}
alias synergy-server="/usr/bin/synergys --enable-crypto --no-daemon --config /etc/synergy/synergy.conf &>/tmp/synergy.log &"
# alias dig="/home/scl/Project/dig-color/dig-color.sh"
alias apk="sudo apk"
alias show_wifi="sudo iw dev wlp1s0 scan |grep SSID"
setup_wifi() {
wpa_passphrase $1 >> /etc/wpa_supplicant/wpa_supplicant-wlp1s0.conf
sudo sv restart wpa_supplicant
}
alias goplayground="godoc -http=:6060 -play -index"
alias zzz="sudo zzz"
alias ZZZ="sudo ZZZ"
alias poweroff="sudo poweroff"
alias reboot="sudo reboot"
export EDITOR='nvim'
#export PATH=$PATH:/sbin:/home/scl/.cabal/bin:/home/scl/bin:/home/scl/bin/seafile-cli
#export PATH="$(ruby -rubygems -e 'puts Gem.user_dir')/bin:$PATH"
export WORKON_HOME=~/Envs
export GOROOT=/usr/lib/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin:/usr/lib/go/bin
export PATH=/sbin:$PATH
export PATH=/usr/sbin:$PATH:/usr/local/bin
export PATH=$PATH:$HOME/.cargo/bin
MAIL=/var/spool/mail/scl && export MAIL
# Tips #######################################
# #
# search lost file in all pkg : pacman -Qkq #
# list wifi-network : sudo iwlist wlan0 scan #
# put wlan0 up : sudo ip link set wlan0 up #
# alsamixer CLI : amixer -c 0 set PCM 2dB+ #
# #
##############################################
#archey3 --config=~/.config/archey3.cfg
#autoload -U compinit promptinit
#compinit
#promptinit; prompt gentoo
alias grep="/bin/grep $GREP_OPTIONS"
unset GREP_OPTIONS
sppr() { curl -F 'sprunge=<-' http://sprunge.us < ${1:-/dev/stdin} ;}
TERM=xterm
# PATH="/home/scl/.cabal/bin:/home/scl/ProgProj/android-sdk-linux/platform-tools:/usr/lib/jvm/java-1.7-openjdk/bin:/home/scl/perl5/bin${PATH+:}${PATH}"; export PATH;
# PERL5LIB="/home/scl/perl5/lib/perl5${PERL5LIB+:}${PERL5LIB}"; export PERL5LIB;
# PERL_LOCAL_LIB_ROOT="/home/scl/perl5${PERL_LOCAL_LIB_ROOT+:}${PERL_LOCAL_LIB_ROOT}"; export PERL_LOCAL_LIB_ROOT;
# PERL_MB_OPT="--install_base \"/home/scl/perl5\""; export PERL_MB_OPT;
# PERL_MM_OPT="INSTALL_BASE=/home/scl/perl5"; export PERL_MM_OPT;
# export ANDROID_HOME="/home/scl/ProgProj/android-sdk-linux"
# export JAVA_HOME="/usr/lib/jvm/java-8-openjdk/jre"
# export SKIP_SASS_BINARY_DOWNLOAD_FOR_CI=true
# export PATH=$PATH:"/home/scl/.gem/ruby/2.3.0/bin"
# fix java white screen bug on dwm cf. https://wiki.archlinux.org/index.php/Dwm#Fixing_misbehaving_Java_applications
# wmname LG3D
# QT
export QT_VERSION=5.8.0
export QT_DIR=/usr/lib/qt5/bin
export QT_STUB=false
export QT_DEBUG=false
export QT_QMAKE_DIR=/usr/lib/qt5/bin
export WORKON_HOME=~/Envs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/bin/virtualenv
source /usr/bin/virtualenvwrapper.sh
alias vp="vim -u ~/.vim.pager -"
# fzf
#export FZF_DEFAULT_OPTS="--preview '[[ $(file --mime {}) =~ binary ]] && echo {} is a binary file || pygmentize -f terminal256 {} | head -500'"
search() {
fzf --preview '[[ $(file --mime {}) =~ binary ]] && echo {} is a binary file || chroma -s pygments {} | head -500'
}
vs() {
vim $(search)
}
alias v="vim"
export FZF_DEFAULT_COMMAND='rg --files'
export FZF_DEFAULT_OPTS=' --preview "[[ $(file --mime {}) =~ directory ]] && ls -l --color=always {} || [[ $(file --mime {}) =~ binary ]] && echo {} is a binary file || chroma -s pygments {} | head -500"'
# export FZF_CTRL_T_OPTS=' --preview "[[ $(file --mime {}) =~ directory ]] && ls -l --color=always {} || [[ $(file --mime {}) =~ binary ]] && echo {} is a binary file || chroma -s pygments {} | head -500"'
# export FZF_ALT_C_OPTS=' --preview "ls -l --color=always {}"'
export FZF_CTRL_R_OPTS=' --preview-window=right:0%'
source /usr/share/doc/fzf/completion.zsh
source /usr/share/doc/fzf/key-bindings.zsh
export RUST_SRC_PATH=/home/scl/rust/rust/src
export QT_QPA_PLATFORMTHEME='qt5ct'
# fzf fix: https://github.com/junegunn/fzf/issues/809
[ -n "$NVIM_LISTEN_ADDRESS" ] && export FZF_DEFAULT_OPTS='--no-height'
# Usefull tools:
# htop
# iotop
# powertop
# nethogs