-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.aliases
executable file
·161 lines (143 loc) · 4.28 KB
/
.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
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
#!/bin/bash
# misc
alias tf='tail -f'
alias ln='ln -v'
alias mkdir='mkdir -p'
alias ...='../..'
alias ....='../../..'
alias df='df -h'
# grep
export GREP_COLOR='3;33'
alias grep='grep --color=auto'
# fzf
alias fc='grep --line-buffered --color=never -r "" * | fzf'
# Enable aliases to be sudo'ed
alias sudo='sudo '
# ls / exa
if installed exa; then
alias ls='exa -F'
alias l='exa -F'
alias lh='exa -AlhF'
alias ll='exa -lgF --git'
alias la='exa -algF --git'
alias lsd='exa -dF */'
alias lt='exa -lgFs modified'
else
# add formatting and color to `ls`
# Detect which `ls` flavor is in use
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
export LS_COLORS="di=36:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34:su=0:sg=0:tw=0:ow=0:"
if ls --color > /dev/null 2>&1; then # GNU `ls`
colorflag="--color"
else # BSD `ls`
colorflag="-G"
fi
alias ls="command ls -Fh $colorflag"
alias l='ls'
alias lh='ls -Alh'
alias ll='ls -Fhl'
alias la='ls -algF --git'
alias lsd="ls -d */"
alias lt='ls -hltr'
fi
# editor
if installed emacs; then
export EDITOR="emacsclient"
alias ed="emacs --daemon"
alias e="emacsclient --no-wait"
alias en="emacsclient -c --no-wait"
installed eless && alias man='PAGER=less man -P eless'
elif installed nvim; then
export EDITOR="nvim"
alias vi='nvim'
alias vim='nvim'
export MANPAGER="nvim -c 'set ft=man' -"
elif installed vim; then
export EDITOR="vim"
alias vi='vim'
fi
# PAGER
if installed vimpager; then
export PAGER="$(which vimpager)"
alias less="$PAGER"
alias zless="$PAGER"
elif installed pygmentize; then
export LESS=' -R '
export LESSOPEN='|pygmentize -f terminal256 -g %s'
elif installed source-highlight; then
export LESS=' -R '
export LESSOPEN='| /usr/local/bin/src-hilite-lesspipe.sh %s'
alias less='less -m -g -i -J --underline-special --SILENT'
fi
# git
# tell git to non-interactively merge commits
export GIT_MERGE_AUTOEDIT=no
alias g="git"
alias gs="git status"
alias ga="git add"
alias gc="git commit"
alias gcm="git commit -m"
alias gp="git push"
alias gpl="git pull"
alias grpl="git reset HEAD --hard; git pull"
alias glog='git log --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit'
# See README for details
git-home-link () {
# Link repo specified by $1 to $HOME using a .git file link
if [ -n "$1" ] && [ -e "$HOME/.config/repos/$1" ]; then
echo "gitdir: .config/repos/$1" >"$HOME/.git"
else
echo "repo \"$1\" not found in $HOME/.config/repos/"
echo "ls $HOME/.config/repos/:"
ls $HOME/.config/repos/
fi
}
# tmux
alias t='tmux'
alias tt='tmux attach; or tmux new'
# ssh
alias sst='ssh -t "tmux -CC attach || tmux -CC"'
# Network
alias whats-my-ip='wget -qO- https://diagnostic.opendns.com/myip && echo'
alias dis='drill +nocmd +noall +answer'
# Reload the shell
alias reload="exec $SHELL -l"
# GRC
if installed grc; then
alias colourify="$(which grc) -es --colour=auto"
alias configure='colourify ./configure'
alias diff='colourify diff'
alias make='colourify make'
alias gcc='colourify gcc'
alias g++='colourify g++'
alias as='colourify as'
alias gas='colourify gas'
alias ld='colourify ld'
alias netstat='colourify netstat'
alias ping='colourify ping'
alias traceroute='colourify traceroute'
alias tracepath='colourify -c conf.traceroute tracepath'
alias arp='colourify -c conf.traceroute arp'
alias tail='colourify -c conf.log tail'
alias ps='colourify -c conf.ps ps'
alias ifconfig='colourify -c conf.traceroute ifconfig'
alias nmap='colourify -c conf.nmap nmap'
alias lsof='colourify -c conf.traceroute lsof'
alias dig='colourify -c conf.traceroute dig'
alias host='colourify -c conf.traceroute host'
alias drill='colourify -c conf.traceroute drill'
alias curl='colourify -c conf.curl curl'
fi
case $(uname) in
Linux) ;;
'CYGWIN*') ;;
Darwin)
# Show/hide hidden files in Finder
alias show-hidden-files="defaults write com.apple.finder AppleShowAllFiles -bool true; and killall Finder"
alias hide-hidden-files="defaults write com.apple.finder AppleShowAllFiles -bool false; and killall Finder"
# Merge PDF files
# Usage: `mergepdf -o output.pdf input{1,2,3}.pdf`
alias mergepdf='/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/join.py'
;;
esac