-
Notifications
You must be signed in to change notification settings - Fork 0
/
.shell-aliases
98 lines (80 loc) · 2.01 KB
/
.shell-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
#!/bin/sh
# Easier navigation
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias dl="cd ~/Downloads"
alias r="cd ~/repos"
# Shortcuts
alias g="git"
alias v="vim"
# Always enable colored `grep` output
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias tldr='tldr --theme ocean'
alias fd='find . -type d -name'
alias ff='find . -type f -name'
# o|open
if which kde-open5 > /dev/null 2>&1; then
alias o="kde-open5"
alias open="kde-open5"
alias kde-open="kde-open5"
fi
# Use mpv instead of mplayer
if which mpv > /dev/null 2>&1; then
alias mplayer="mpv"
fi
# Use colorsvn if available
if which colorsvn > /dev/null 2>&1; then
alias svn="colorsvn"
fi
# Create tab2spaces command
if which expand > /dev/null 2>&1; then
alias tab2spaces='expand --tabs=4'
fi
# Detect which `ls` flavor is in use
if ls --color > /dev/null 2>&1; then
colorflag="--color"
else
colorflag="-G"
fi
alias ls="command ls ${colorflag}"
# When avaiable, prefer exa over plain ls
if which exa >/dev/null 2>&1; then
alias ls='exa'
fi
# alias vim
if which nvim >/dev/null 2>&1; then
alias vim='nvim'
elif which vim >/dev/null 2>&1; then
alias vi='vim'
fi
if which rg >/dev/null 2>&1; then
alias ag='rg'
alias ack='ag'
elif which ag >/dev/null 2>&1; then
alias rg='ag'
alias ack='ag'
elif which ack >/dev/null 2>&1; then
alias rg='ack'
alias ag='ack'
fi
if which mosh >/dev/null 2>&1; then
alias ssh='mosh'
fi
if which thefuck >/dev/null 2>&1; then
eval $(thefuck --alias)
fi
# zsh
if which is-at-least >/dev/null 2>&1; then
_editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex)
for ft in $_editor_fts; do alias -s $ft=$EDITOR; done
if [[ -n "$BROWSER" ]]; then
_browser_fts=(htm html de org net com pdf)
for ft in $_browser_fts; do alias -s $ft=$BROWSER; done
fi
_media_fts=(ape avi flv m4a mkv mov mp3 mpeg mpg ogg ogm rm wav webm)
for ft in $_media_fts; do alias -s $ft=mpv; done
fi