-
Notifications
You must be signed in to change notification settings - Fork 1
/
dot_aliases
92 lines (69 loc) · 2.01 KB
/
dot_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
#!/usr/bin/env sh
case $(uname -s) in
Linux*)
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls="ls --color=auto"
alias dir="dir --color=auto"
alias vdir="vdir --color=auto"
alias grep="grep --color=auto"
alias fgrep="fgrep --color=auto"
alias egrep="egrep --color=auto"
fi
;;
Darwin*)
alias ls="ls -FG"
alias flush="dscacheutil -flushcache"
;;
esac
# Navigation
alias ..="cd .."
alias ...="cd ../.."
alias ll="ls -la"
# Text-mangling
alias tawk="awk -v FS='\t' -v OFS='\t'"
alias w2u="iconv -f cp1251 -t utf-8"
alias u2w="iconv -f utf-8 -t cp1251"
# Dumb shortcuts
alias v="vim"
alias fs="stat -f '%z bytes'"
# Smart shortcuts
alias realpath="python -c 'import os, sys; print os.path.realpath(sys.argv[1])' $@"
alias rmorig="find . -name '*.orig' -delete"
alias rmbom="perl -CD -pe 'tr/\x{feff}//d'"
# git
alias g="git"
alias ga="git add"
alias gai="git add --interactive"
alias gb="git branch"
alias gba="git branch -a"
alias gc="git commit"
alias gco="git checkout"
alias gd="git diff"
alias gdc="git diff --cached"
alias gs="git status"
alias gst="git status"
alias glg="git log-graph"
alias gLg="git log-short"
alias gll="git --no-pager log-graph -5 && echo"
alias gLL="git --no-pager log-short -5 && echo"
alias gl="git pull --rebase"
alias gp="git push"
alias grr="git reset HEAD . ; git checkout ."
alias gsu="git submodule update --init --recursive"
# chezmoi
alias cz="chezmoi"
# tmux
refresh_tmux() {
if [[ -n $TMUX ]]; then
NEW_SSH_AUTH_SOCK=`tmux showenv | grep ^SSH_AUTH_SOCK | cut -d = -f 2`
if [[ -n $NEW_SSH_AUTH_SOCK ]] && [[ -S $NEW_SSH_AUTH_SOCK ]]; then
SSH_AUTH_SOCK=$NEW_SSH_AUTH_SOCK
export SSH_AUTH_SOCK
fi
DISPLAY=`tmux showenv | grep ^DISPLAY | cut -d = -f 2`
export DISPLAY
fi
}
# *sh
alias reload='exec "$SHELL" -l'