2020-07-26 20:15:21 +00:00
|
|
|
#!/usr/local/bin/fish
|
|
|
|
|
|
|
|
function aliases --description 'All aliases'
|
|
|
|
|
|
|
|
# Directory aliases
|
|
|
|
alias ls 'exa' # exa = improved ls
|
|
|
|
abbr -a l 'ls' # Quicker shortcut for ls
|
|
|
|
abbr -a lh 'ls -lh' # Pretty vertical list
|
|
|
|
abbr -a ll 'ls -alhF' # Include hidden files
|
2020-07-26 21:31:54 +00:00
|
|
|
abbr -a c 'cd'
|
2020-07-26 20:15:21 +00:00
|
|
|
|
2020-11-23 23:14:48 +00:00
|
|
|
# Tmux
|
|
|
|
abbr -a ta 'tmux attach-session'
|
|
|
|
abbr -a tan 'tmux attach-session -t noah'
|
2020-11-25 16:45:11 +00:00
|
|
|
abbr -a tnn 'tmux new-session -s noah'
|
2020-11-23 23:14:48 +00:00
|
|
|
|
2020-07-26 20:15:21 +00:00
|
|
|
# Git
|
2020-11-25 17:14:44 +00:00
|
|
|
abbr -a gs 'git status'
|
2020-07-26 20:15:21 +00:00
|
|
|
abbr -a gd 'git diff'
|
2020-11-23 04:20:18 +00:00
|
|
|
abbr -a gds 'git diff --staged'
|
|
|
|
abbr -a ga 'git add'
|
|
|
|
abbr -a gaa 'git add -A'
|
2020-11-24 04:05:02 +00:00
|
|
|
abbr -a gac 'git commit -am'
|
2020-07-26 20:15:21 +00:00
|
|
|
abbr -a gc 'git commit -m'
|
2020-11-23 23:48:43 +00:00
|
|
|
abbr -a gca 'git commit --amend'
|
2020-07-26 21:31:54 +00:00
|
|
|
abbr -a gu 'git pull'
|
2020-07-26 20:16:02 +00:00
|
|
|
abbr -a gp 'git push'
|
2020-11-23 04:33:00 +00:00
|
|
|
abbr -a gpp 'git_set_upstream'
|
2020-11-23 04:20:18 +00:00
|
|
|
abbr -a gl 'git log --graph --decorate --oneline -20'
|
|
|
|
abbr -a gll 'git log --graph --decorate --oneline'
|
|
|
|
abbr -a gco 'git checkout'
|
2020-11-23 23:13:50 +00:00
|
|
|
abbr -a gcom 'git checkout master'
|
2020-11-23 04:20:18 +00:00
|
|
|
abbr -a gcob 'git checkout -b'
|
|
|
|
abbr -a gb 'git branch'
|
2020-11-25 14:59:43 +00:00
|
|
|
abbr -a gbd 'git branch -d'
|
|
|
|
abbr -a gbD 'git branch -D'
|
2020-11-24 03:45:05 +00:00
|
|
|
abbr -a gr 'git reset'
|
2020-11-23 04:20:18 +00:00
|
|
|
abbr -a grh 'git reset --hard'
|
2020-11-23 23:13:50 +00:00
|
|
|
abbr -a gm 'git merge'
|
2020-11-24 03:34:14 +00:00
|
|
|
abbr -a gmf 'git-merge-fuzzy'
|
2020-11-24 04:36:02 +00:00
|
|
|
abbr -a gcp 'git cherry-pick'
|
2020-11-25 03:28:42 +00:00
|
|
|
abbr -a ghr 'gh repo view -w'
|
2020-07-26 20:15:21 +00:00
|
|
|
|
|
|
|
# Vim
|
2020-07-26 21:31:54 +00:00
|
|
|
abbr -a v 'vim'
|
2020-07-26 20:15:21 +00:00
|
|
|
if command -v nvim > /dev/null
|
|
|
|
alias vim='nvim' # Use neovim if installed
|
|
|
|
abbr -a vimrc 'vim $HOME/.config/nvim/init.vim' # Edit ".vimrc" file
|
|
|
|
end
|
|
|
|
|
|
|
|
# Improved CLI Tools
|
|
|
|
alias ping='prettyping --nolegend'
|
|
|
|
abbr -a cat 'bat' # Swap cat with bat
|
|
|
|
abbr -a h 'http -Fh --all' # Curl site for headers
|
|
|
|
|
|
|
|
# Fun CLI Tools
|
2020-11-25 16:45:11 +00:00
|
|
|
abbr goo 'googler'
|
|
|
|
abbr gooj 'googler -j'
|
2020-07-26 20:15:21 +00:00
|
|
|
alias weather='curl wttr.in'
|
|
|
|
alias moon='curl wttr.in/Moon'
|
|
|
|
alias ipinfo='curl ipinfo.io'
|
|
|
|
alias worldmap='telnet mapscii.me'
|
2020-11-25 16:45:11 +00:00
|
|
|
function ip
|
|
|
|
if count $argv > /dev/null
|
|
|
|
curl ipinfo.io/$argv
|
|
|
|
else
|
|
|
|
curl checkip.amazonaws.com
|
|
|
|
end
|
|
|
|
end
|
2020-08-02 00:06:16 +00:00
|
|
|
function qr
|
|
|
|
qrencode $argv[1] -o /tmp/qr.png | open /tmp/qr.png
|
|
|
|
end
|
2020-12-01 14:36:07 +00:00
|
|
|
function psf
|
|
|
|
ps aux | rg -v "$USER.*rg $argv" | rg $argv
|
|
|
|
end
|
2020-07-26 20:15:21 +00:00
|
|
|
|
|
|
|
# Dotfile and config shortcuts
|
|
|
|
alias reload='source $DOTS/fish.configlink/config.fish' # Refresh fish shell
|
|
|
|
abbr -a boot '$DOTS/scripts/bootstrap'
|
|
|
|
abbr -a sshc 'vim ~/.ssh/config'
|
2020-08-02 00:06:16 +00:00
|
|
|
abbr -a hosts 'sudo nvim /etc/hosts'
|
2020-07-26 20:15:21 +00:00
|
|
|
abbr -a frc 'vim $HOME/.config/fish/config.fish'
|
|
|
|
abbr -a falias 'vim $HOME/.config/fish/functions/aliases.fish'
|
|
|
|
|
|
|
|
# Cheat Sheets
|
|
|
|
abbr -a ssl 'openssl req -new -newkey rsa:2048 -nodes' \
|
|
|
|
'-keyout server.key -out server.csr'
|
2020-11-25 16:45:11 +00:00
|
|
|
abbr -a fingerprint 'ssh-keyscan myhost.com | ssh-keygen -lf -'
|
|
|
|
abbr -a publickey 'ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub'
|
2020-07-26 20:15:21 +00:00
|
|
|
|
|
|
|
# Docker
|
|
|
|
abbr -a dc '$DOTS/bin/docker_cleanup'
|
2020-07-31 01:12:17 +00:00
|
|
|
abbr -a dr 'docker run --rm -it'
|
2020-07-26 20:15:21 +00:00
|
|
|
abbr -a db 'docker build . -t'
|
2020-07-31 01:12:17 +00:00
|
|
|
abbr -a ds 'docker ps -a'
|
|
|
|
abbr -a de 'docker exec -it'
|
2020-11-25 03:28:42 +00:00
|
|
|
abbr -a dpy 'docker run --rm -it -v $PWD:/project python:alpine python'
|
|
|
|
abbr -a alp 'docker run --rm -it -v $PWD:/project alpine sh'
|
2020-07-26 20:15:21 +00:00
|
|
|
alias connect='docker run --rm -v ~/.aws:/root/.aws -v ~/.ssh:/root/.ssh -it connect-aws'
|
|
|
|
|
|
|
|
# Terraform
|
|
|
|
abbr -a te 'terraform'
|
2020-11-25 16:45:11 +00:00
|
|
|
abbr -a tap 'terraform apply'
|
2020-07-26 20:15:21 +00:00
|
|
|
|
2020-08-01 00:44:02 +00:00
|
|
|
# Kubernetes
|
|
|
|
abbr -a k 'kubectl'
|
|
|
|
abbr -a pods 'kubectl get pods -A'
|
|
|
|
abbr -a nodes 'kubectl get nodes'
|
2020-08-06 03:14:29 +00:00
|
|
|
abbr -a deploys 'kubectl get deployments -A'
|
|
|
|
abbr -a dash 'kube-dashboard'
|
2020-08-01 00:44:02 +00:00
|
|
|
|
2020-07-26 20:15:21 +00:00
|
|
|
# Python
|
2020-08-06 03:14:29 +00:00
|
|
|
abbr -a py 'python'
|
|
|
|
abbr -a po 'poetry'
|
|
|
|
abbr -a pr 'poetry run python'
|
2020-08-19 13:40:02 +00:00
|
|
|
abbr -a pl 'poetry run pylint *'
|
|
|
|
abbr -a black 'poetry run black --target-version py38 .'
|
|
|
|
abbr -a bl 'poetry run black --target-version py38 .'
|
2020-07-26 20:15:21 +00:00
|
|
|
alias domisty='cd $PROJ/misty && ./buildrun.sh'
|
|
|
|
|
|
|
|
# Rust
|
|
|
|
abbr -a ca 'cargo'
|
|
|
|
|
|
|
|
# Non-MacOS
|
|
|
|
if [ (uname) = "Linux" ]
|
|
|
|
alias pbcopy='xclip -selection clipboard -in'
|
|
|
|
alias pbpaste='xclip -selection clipboard -out'
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|