-
Notifications
You must be signed in to change notification settings - Fork 1
/
dot_aliases
49 lines (45 loc) · 3.71 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
# Detect which `ls` flavor is in use
if ls --color > /dev/null 2>&1; then # GNU `ls`
colorflag="--color"
export LS_COLORS='no=00:fi=00:di=01;31:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:'
else # macOS `ls`
colorflag="-G"
# export LSCOLORS='BxBxhxDxfxhxhxhxhxcxcx'
fi
# List all files colorized in long format, including dot files
alias ll="ls -laF ${colorflag}"
# Always use color output for `ls`
alias ls="command ls ${colorflag}"
# Always enable colored `grep` output
# Note: `GREP_OPTIONS="--color=auto"` is deprecated, hence the alias usage.
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
# IP addresses
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias localip="ipconfig getifaddr en0"
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
alias gvim="mvim"
alias vi="vim"
alias k="kubectl"
alias kc="kubectl --context"
alias sc="stern --context"
alias updrepo="gfind . -type d -name .git ! -path '*/.terraform/*' ! -path '*/.direnv/*' -printf 'Updating repository %h\n' -execdir bash -c 'git ls-remote >/dev/null 2>&1 && git up' \;"
alias dirtyrepo="gfind . -type d -name .git ! -path '*/.terraform/*' ! -path '*/.direnv/*' -printf '%h: ' -execdir bash -c \"if [[ -z \\\"\\\$(git status --porcelain | tail -n1)\\\" ]]; then echo Clean | color green Clean; else echo Dirty | color red Dirty; fi\" \;"
alias branches="gfind . -type d -name .git ! -path '*/.terraform/*' ! -path '*/.direnv/*' -printf 'Repository %h: ' -execdir sh -c \"git branch -l | awk '{\\\$1=\\\$1};1' | sort | paste -d, -s | color red '* [^, ]*' green '* master'\" \;"
alias allbranches="gfind . -type d -name .git ! -path '*/.terraform/*' ! -path '*/.direnv/*' -printf 'Repository %h: ' -execdir sh -c \"git branch -a | grep -vE 'origin/ma(ster|in)' | awk '{\\\$1=\\\$1};1' | sort | paste -d, -s | color red '* [^, ]*' green '* master' green '* main'\" \;"
alias stashes="gfind . -type d -name .git ! -path '*/.terraform/*' ! -path '*/.direnv/*' -printf 'Repository %h: ' -execdir sh -c \"git stash list | paste -d, -s\" \;"
# Checkout default branch in all Git repositories found in sub-directories
alias cdb="gfind . -type d -name .git ! -path '*/.terraform/*' ! -path '*/.direnv/*' -printf 'Repository %h:\n' -execdir sh -c \"git checkout \$((git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null || echo 'main') | sed 's@^refs/remotes/origin/@@') > /dev/null 2>&1 || git checkout main > /dev/null 2>&1 || git checkout master > /dev/null 2>&1\" \;"
alias prune="gfind . -type d -name .git ! -path '*/.terraform/*' ! -path '*/.direnv/*' | xargs -I {} zsh -ic \"echo 'Pruning repository {}' && cd {} && gbl | grep '\[gone\]' | grep -vE '^\*' | sed 's/^\s\+\([^ ]*\).*$/\1/' | xargs -r git branch -d --force \" \;"
alias format-scala="find src -type d -name scala | xargs scalariform -r -p=.scalariform.conf"
alias gup="git up"
alias gcpa="git cherry-pick --abort"
alias gcpc="git cherry-pick --continue"
alias gcps="git cherry-pick --skip"
# Print each PATH entry on a separate line
alias path='echo -e ${PATH//:/\\n}'
alias awslocal="aws --endpoint-url http://localhost:4566"
alias tf="terraform"
alias tff="terraform fmt --recursive"
alias cm="chezmoi"