10_alias.zsh (1516B)
1 # Git 2 gs() { git status $@ } 3 ga() { git add $@ } 4 gc() { git commit -s $@ } 5 gca() { git commit -s --amend $@ } 6 gp() { git push --force-with-lease $@ } 7 gf() { git fetch $@ } 8 9 # Run remote post-receive hook without changing repository. 10 grecv() { git commit --amend --allow-empty --no-edit; git push -f } 11 12 # Dotfiles 13 dotfiles() { git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $@ } 14 15 ds() { dotfiles status $@ } 16 da() { dotfiles add $@ } 17 dc() { dotfiles commit -s $@ } 18 dca() { dotfiles commit -s --amend $@ } 19 dp() { dotfiles push --force-with-lease $@ } 20 df() { dotfiles fetch $@ } 21 22 # VPN 23 vpnup() { doas wg-quick up } 24 vpndown() { doas wg-quick down } 25 26 # Misc 27 reload() { source ~/.zshrc } 28 ls() { lsd --hyperlink=auto -AlL --icon-theme unicode $@ 2>/dev/null } 29 30 # Better ui for core utils 31 # Note: None of these ultimately change the behavior of the commands, just give 32 # a better user experience 33 34 # Helper function, runs the first argument with a nice UI showing the progress. 35 # It waits 5 seconds before showing the progress in case it is a quick operation. 36 # See progress --help for a list of the commands supported. 37 monitor() { 38 $@ &! 39 PID=$! 40 waitpid --timeout 5 $PID &> /dev/null 41 if [ $? -gt 0 ]; then 42 progress --wait --monitor --additional-command $1 --pid $PID 43 kill $PID &> /dev/null 44 fi 45 exit 0 46 } 47 48 #cp() { monitor /usr/bin/cp $@ } 49 #rm() { monitor /usr/bin/rm $@ } 50 #mv() { monitor /usr/bin/mv $@ } 51 #tar() { monitor /usr/bin/tar $@ } 52 #gzip() { monitor /usr/bin/gzip $@ } 53 #gunzip() { monitor /usr/bin/gunzip $@ }