-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zsh_aliases
100 lines (83 loc) · 2.29 KB
/
.zsh_aliases
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
### Maven ###
require mvn && {
alias mci='mvn clean install'
alias mcp='mvn clean package'
alias mdt='mvn dependency:tree'
}
### Python ###
require python2 && {
alias python=python2
alias pip2="python2 -m pip"
alias pip=pip2
}
require python3 && {
alias python=python3
alias pip3="python3 -m pip"
alias pip=pip3
}
### Sudo ###
alias ,='sudo '
alias ,,='history | tail -n 1 | cut -c 8- | sudo -i'
### Screen ###
require screen && {
alias ssx='screen -x -S '
alias ss='screen -S '
}
### Git ###
alias gad='git add .'
alias gds='git diff --staged'
alias gcur='git_current_branch'
alias gdh='git diff HEAD~1..HEAD'
alias gcom='git checkout origin/master'
alias grbas='git rebase --autostash'
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "wip"'
ggb() {
git grep -n "$1" | while IFS=: read i j k; do echo `git blame -f -L $j,$j $i`; done
}
### Nim ###
alias nr='nim c -r --verbosity:0 --threads:on'
function nimi {
nim c -d:release --threads:on "-o:$NIMBIN/"`basename "$1" .nim` "$1"
}
### Haskell ###
alias hi='ghci +RTS -M5g'
### Dotfiles ###
alias reload="source ~/.zshrc"
alias editrc="$VISUAL ~/.zshrc; reload"
alias vimrc="vim ~/.vimrc"
### Misc ###
function i3se {
for l in `sudo cat /proc/$(pgrep -x i3)/environ | tr '\0' '\n' | grep SSH`; do export $l; done
}
function mcd {
mkdir -p $@
cd $@
}
require irssi run-one screen && function irc { screen -dRmS irc run-one irssi }
require vim && alias vi='vim'
require rsync && alias rsyncp='rsync -avz --no-i-r --info=progress2'
alias c=clear
alias re='grep -oP'
alias wh=whence
alias psg='ps aux | grep -i'
alias af='alias | grep'
function gh {
grep -R $@ .
}
function t {
type -a $@ | grep -q "shell function" && type -f $@ || type -a $@
}
function linux_aliases {
require google-chrome-stable && alias chrome='google-chrome-stable %U --high-dpi-support=1 --force-device-scale-factor=1.2'
}
function mac_aliases {
alias chrome-dev="open -a Google\ Chrome --args --disable-web-security --user-data-dir"
alias flushdns="sudo discoveryutil mdnsflushcache"
alias ij='open -b com.jetbrains.intellij.ce'
}
case "$OSTYPE" in
darwin*); mac_aliases;;
linux*); linux_aliases;;
esac
unset -f linux_aliases
unset -f mac_aliases