-
Notifications
You must be signed in to change notification settings - Fork 0
/
.shell_aliases
78 lines (67 loc) · 2.71 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
#!/usr/bin/env zsh
#uncategorized:
alias today='date +"%b_%d_%Y"'
alias root='cd $(git rev-parse --show-toplevel)'
#edit configs fast:
alias esa='$EDITOR $DOT_FILES/.shell_aliases'
alias ess='$EDITOR $DOT_FILES/.shell_secrets'
alias esf='$EDITOR $DOT_FILES/.shell_functions'
alias ez='$EDITOR $DOT_FILES/.zshrc'
alias ev='$EDITOR $DOT_FILES/.vimrc'
#reset configs fast:
alias sz='source $DOT_FILES/.zshrc; echo source $DOT_FILES/.zshrc'
#relative navigation:
L=".." #this remaps '..' to 'cd ..', '...' to 'cd ../..', etc
R="../"
for n in {1..7}
do
alias $L="cd $R"
L="$L."
R="$R../"
done
unset L
unset R
alias -- -='cd -' #this remaps '-' to 'cd -', don't ask me how
#ls:
alias l='ls -lahF' #detailed ls
alias l.='ls -ldF .*' #only hidden stuff
#grep:
alias grep='grep --color -I' #be colorful and ignore binary files and svn directories
#tools:
alias trim="sed -e 's/^ *//g' -e 's/ *$//g'" #remove trailing and leading whitespace
alias count='sort | uniq -c | sort -n' #count how many times things appear
alias len='wc -l | trim' #how many lines given in stdin
alias pysum='egrep "class |def "' #quick outline of a python files based on function and class names
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" #print out the directory structure in a tree format
alias space='du -ks ./* | sort -n'
alias intersect="grep -xF -f" #set intersection of two files, linewise
alias sshl='ssh -L 5555:localhost:5432' #easy ssh tunnel
alias lk='pmset displaysleepnow; qq' #locks screen (and exits) on mac only
alias beep='say "done" && osascript -e "display notification \"All done\" with title \"Done\""'
alias chargestats="system_profiler -json SPPowerDataType | jq -r '.SPPowerDataType[] | select(._name == \"sppower_ac_charger_information\")'"
alias clone='$DOT_FILES/scripts/clone.py'
#abbreviations
alias diff='git --no-pager diff --no-index' #default git's colorful diff
alias qq='exit 0'
alias vi='vim'
alias yti='yarn test:integration'
alias ytu='yarn test:unit'
alias yc='yarn compile'
alias ta='command terraform apply'
alias tp='command terraform plan'
alias ti='command terraform init'
terraform () {
if [ "$1" = "apply" ] ; then
echo "Error: Please use the ta alias for terraform apply."
elif [ "$1" = "plan" ] ; then
echo "Error: Please use the tp alias for terraform plan."
elif [ "$1" = "init" ] ; then
echo "Error: Please use the ti alias for terraform init."
else
command terraform "$@"
fi
}
alias pr='gh pr view --web' #overwrites /usr/bin/pr (https://docs.oracle.com/cd/E19683-01/816-0210/6m6nb7mhu/index.html)
# spell check
alias k='$(fc -ln -1)' # when I'm in insert mode and thought I was in normal mode to go to the previous command, run the last command anyways!
alias kk='$(fc -ln -2)'