aliasrc 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. # adding some colors to the world
  2. alias ls='ls --color=auto'
  3. alias grep='grep --color=auto'
  4. alias ccat='highlight --out-format=ansi' # like cat, but w/ syntax highlighting
  5. alias diff='diff --color=auto'
  6. # human readable pls
  7. alias du='du -h'
  8. alias df='df -h'
  9. alias free='free -h'
  10. # basic system aliases
  11. alias p='doas pacman'
  12. alias sc='doas systemctl'
  13. alias sdn='shutdown now > /dev/null 2> /dev/null || doas /usr/bin/openrc-shutdown --poweroff now'
  14. alias sus='systemctl suspend || loginctl suspend'
  15. alias re='reboot || doas openrc-shutdown --reboot now '
  16. alias q='exit'
  17. alias sx='startx "$XDG_CONFIG_HOME/X11/xinitrc" --'
  18. alias ll='ls -l'
  19. alias la='ls -A'
  20. alias resource='source ${ZDOTDIR:-$HOME}/.zshrc'
  21. # frequently used programs aliases
  22. alias r='ranger'
  23. alias ca='calcurse'
  24. alias py='python'
  25. #alias wget='wget --hsts-file ~/.cache/wget/wget-hsts'
  26. alias si='devour sxiv'
  27. alias lo='devour libreoffice'
  28. alias mu='devour mupdf'
  29. alias llp='devour llpp'
  30. alias nb='newsboat'
  31. alias mutt='neomutt'
  32. # copy and paste using xclip package
  33. alias copy="xclip -sel clip"
  34. alias paste="xclip -out -sel clip"
  35. # lockscreen
  36. alias lock='betterlockscreen -s dim'
  37. # faster directory switching
  38. alias ..='cd ..'
  39. alias ...='cd ../..'
  40. alias ....='cd ../../..'
  41. alias .....='cd ../../../..'
  42. # vim, v -> neovim
  43. alias vim='nvim'
  44. alias v='vim'
  45. # set background
  46. setbg() {
  47. feh --bg-scale "$1"
  48. [ -f "$HOME/.fehbg" ] && mv "$HOME/.fehbg" "$XDG_CACHE_HOME" && bv -u
  49. }
  50. # safety features
  51. alias rm='rm -i'
  52. alias cp='cp -i'
  53. alias mv='mv -i'
  54. # git aliases
  55. alias gsetkey="git config --add --local core.sshCommand 'ssh -i \$GIT_SSH_KEY'"
  56. alias clone="git clone -c core.sshCommand='/usr/bin/ssh -i \$GIT_SSH_KEY'"
  57. alias gs='git status'
  58. alias gd='git diff'
  59. alias add='git add'
  60. alias commit='git commit'
  61. alias fetch='git fetch'
  62. alias pull='git pull'
  63. alias push='git push'
  64. alias log='git log'
  65. alias remote='git remote'
  66. alias tag='git tag'
  67. alias checkout='git checkout'
  68. alias merge='git merge'
  69. alias branch='git branch'
  70. alias lsc='git log --graph --oneline --decorate --all'
  71. alias lsb="git log --graph --simplify-by-decoration --pretty=format:'%d' --all"
  72. alias lst="git log --graph --decorate --all --date=short --abbrev-commit --oneline --pretty=format:'%h%x09%an%x09%ad%x09%s'"
  73. # ~/ cleanup
  74. alias yarn="yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config"
  75. alias xbindkeys="xbindkeys -f $XDG_CONFIG_HOME/xbindkeys/config"
  76. alias abook="abook --config $XDG_CONFIG_HOME/abook/abookrc --datafile $XDG_DATA_HOME/abook/addressbook"
  77. # always open st in non-interactive mode
  78. alias nst="st > /dev/null 2> /dev/null &disown"
  79. # sane ytdl shortcuts
  80. alias yt="youtube-dl --add-metadata -i"
  81. alias yta="yt -x -f bestaudio/best"
  82. # imagemagick shortcuts
  83. alias dpi="identify -format '%x\n' -units PixelsPerInch"
  84. alias rmexif="exiftool -overwrite_original -all="
  85. # fast dir switching
  86. s() {
  87. cd "$(ls -d ~/.local/src/* | fzf)"
  88. }
  89. b() {
  90. file="$(ls ~/.local/bin/* | fzf)"
  91. [ -n "$file" ] && "$EDITOR" "$file"
  92. }
  93. c() {
  94. pushd "$HOME/.local/src/dotfiles" > /dev/null || exit 1
  95. file="$(find dot-config -type f | fzf)"
  96. [ -n "$file" ] &&
  97. "$EDITOR" "${file/dot-config\//${XDG_CONFIG_HOME:-$HOME/.config}/}"
  98. popd > /dev/null
  99. }
  100. # useful extended system aliases
  101. alias perm="stat -c \"%a %n\" --"
  102. installedsize() {
  103. pacman -Qi | egrep '^(Name|Installed)' | cut -f2 -d':' | sed 's/^ //' | \
  104. grep -A1 "$1" | grep -v "\-\-" | \
  105. awk '{ printf "%s%s", $0, (NR%2==1 ? FS : RS) }' | column -t
  106. }
  107. etouch() {
  108. [ -n "$1" ] && touch "$1" chmod +x "$1"
  109. }
  110. evim() {
  111. [ -n "$1" ] && touch "$1" && chmod +x "$1" && v "$1"
  112. }
  113. mkcd() {
  114. [ -n "$1" ] && mkdir "$1" && cd "$1"
  115. }
  116. # more non-system essential aliases
  117. djangokeygen() { python -c 'from django.core.management.utils import get_random_secret_key; \
  118. print(get_random_secret_key())' || pip install django
  119. }