dotfiles/fish.configlink/functions/abbrs.fish

151 lines
4.2 KiB
Fish
Raw Normal View History

2020-07-26 20:15:21 +00:00
#!/usr/local/bin/fish
function abbrs --description 'All abbreviations'
2020-07-26 20:15:21 +00:00
# Directory aliases
2021-11-24 22:12:26 +00:00
abbr -a l ls
2020-12-22 02:09:53 +00:00
abbr -a lh 'ls -lh'
abbr -a ll 'ls -alhF'
2021-04-10 02:00:18 +00:00
abbr -a lf 'ls -lh | fzf'
2021-11-24 22:12:26 +00:00
abbr -a c cd
abbr -a -- - 'cd -'
2020-12-22 02:09:53 +00:00
abbr -a proj 'cd $PROJ'
2021-04-10 04:10:30 +00:00
abbr -a mkd 'mkdir -pv'
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
2021-11-24 22:12:26 +00:00
abbr -a g git
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'
2021-04-08 14:48:27 +00:00
abbr -a gdp 'git diff HEAD^'
2020-11-23 04:20:18 +00:00
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'
2021-12-28 05:27:54 +00:00
abbr -a gca 'git commit --amend --no-edit'
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'
2021-11-24 22:12:26 +00:00
abbr -a gpp git-push-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'
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 04:36:02 +00:00
abbr -a gcp 'git cherry-pick'
abbr -a cdg 'cd (git rev-parse --show-toplevel)'
2021-05-23 16:35:13 +00:00
# GitHub
2020-11-25 03:28:42 +00:00
abbr -a ghr 'gh repo view -w'
2021-07-07 02:18:30 +00:00
abbr -a gha 'gh run list | head -1 | awk \'{ print $(NF-2) }\' | xargs gh run view'
2021-09-16 18:57:49 +00:00
abbr -a grw 'noti gh run watch'
2021-05-23 16:35:13 +00:00
abbr -a grf 'gh run view --log-failed'
abbr -a grl 'gh run view --log'
2021-09-16 18:57:49 +00:00
abbr -a ghpr 'gh pr create && sleep 3 && noti gh run watch'
2021-09-28 13:15:48 +00:00
abbr -a ghm 'gh pr merge -s -d && git pull'
2020-07-26 20:15:21 +00:00
# Vim
2021-11-24 22:12:26 +00:00
if command -v nvim >/dev/null
2021-05-04 15:38:00 +00:00
alias --save vim='nvim'
2021-05-13 18:46:27 +00:00
abbr -a vimrc 'vim $HOME/.config/nvim/init.lua'
2021-05-04 14:00:38 +00:00
else
2021-05-12 22:59:22 +00:00
alias --save vim='vim'
2021-05-04 14:00:38 +00:00
abbr -a vimrc 'vim $HOME/.vimrc'
end
2021-11-24 22:12:26 +00:00
abbr -a v vim
2021-04-08 14:48:27 +00:00
abbr -a vl 'vim -c "normal! `0"'
2021-11-09 04:48:02 +00:00
abbr -a vll 'vim -c "Telescope oldfiles"'
abbr -a vh 'vim -c "Telescope oldfiles"'
# Notes
2021-11-24 22:12:26 +00:00
abbr -a qn quicknote
abbr -a sn syncnotes
abbr -a to today
2021-05-14 23:44:49 +00:00
abbr -a work 'vim $NOTES_PATH/work.md'
2020-07-26 20:15:21 +00:00
2021-11-24 22:12:26 +00:00
# RSS
abbr -a nb newsboat
2020-07-26 20:15:21 +00:00
# Improved CLI Tools
2021-11-24 22:12:26 +00:00
abbr -a cat bat # Swap cat with bat
abbr -a h 'http -Fh --all' # Curl site for headers
2021-11-24 22:12:26 +00:00
abbr -a j just
2020-07-26 20:15:21 +00:00
# Fun CLI Tools
2021-05-08 21:39:52 +00:00
abbr weather 'curl wttr.in/$WEATHER_CITY'
abbr moon 'curl wttr.in/Moon'
2020-07-26 20:15:21 +00:00
# Dotfile and config shortcuts
2021-11-24 22:12:26 +00:00
abbr -a s sudo
2020-07-26 20:15:21 +00:00
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/abbrs.fish'
2020-07-26 20:15:21 +00:00
# Cheat Sheets
abbr -a ssl 'openssl req -new -newkey rsa:2048 -nodes' \
2021-11-24 22:12:26 +00:00
'-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'
2021-04-26 16:55:33 +00:00
abbr -a forloop 'for i in (seq 1 100)'
2021-04-28 12:58:14 +00:00
abbr -a gatekeeper 'sudo spctl --master-disable'
2021-12-28 05:27:54 +00:00
abbr -a flushdns 'sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder'
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
# Terraform
2021-11-24 22:12:26 +00:00
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
2021-11-24 22:12:26 +00:00
abbr -a k kubectl
2020-08-01 00:44:02 +00:00
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'
2021-11-24 22:12:26 +00:00
abbr -a dash kube-dashboard
abbr -a ks k9s
2020-08-01 00:44:02 +00:00
2021-05-08 21:39:52 +00:00
# Cloud
abbr -a awsc 'vim ~/.aws/credentials'
2020-07-26 20:15:21 +00:00
# Python
2021-11-24 22:12:26 +00:00
abbr -a py python
abbr -a po poetry
2020-08-06 03:14:29 +00:00
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
# Rust
2021-11-24 22:12:26 +00:00
abbr -a ca cargo
2020-07-26 20:15:21 +00:00
# macOS
abbr -a casks 'vim $DOTS/homebrew/Caskfile'
2021-11-24 22:12:26 +00:00
abbr -a t trash
2020-07-26 20:15:21 +00:00
2021-05-04 14:00:38 +00:00
# Linux
2021-11-24 22:12:26 +00:00
if [ (uname) = Linux ]
2021-05-04 14:00:38 +00:00
linux
end
2020-07-26 20:15:21 +00:00
end