aliasrc 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. alias removeorphanedpkgs='pacman -Qtdq | doas pacman -Rns -'
  22. # frequently used programs aliases
  23. alias r='ranger'
  24. alias ca='calcurse-caldav && calcurse && calcurse-caldav'
  25. alias py='python'
  26. #alias wget='wget --hsts-file ~/.cache/wget/wget-hsts'
  27. alias si='devour sxiv'
  28. alias lo='devour libreoffice'
  29. alias mu='devour mupdf'
  30. alias llp='devour llpp'
  31. alias d='devour'
  32. alias nb='newsboat'
  33. alias mutt='neomutt'
  34. alias ne='neomutt'
  35. # copy and paste
  36. alias x11-copy="xclip -sel clip"
  37. alias x11-paste="xclip -out -sel clip"
  38. alias copy="wl-copy"
  39. alias paste="wl-paste"
  40. # lockscreen
  41. alias lock='betterlockscreen -s dim'
  42. # faster directory switching
  43. alias ..='cd ..'
  44. alias ...='cd ../..'
  45. alias ....='cd ../../..'
  46. alias .....='cd ../../../..'
  47. # vim, v -> neovim
  48. alias vim='nvim'
  49. alias v='vim'
  50. # set background
  51. setbg() {
  52. feh --bg-scale "$1"
  53. [ -f "$HOME/.fehbg" ] && mv "$HOME/.fehbg" "$XDG_CACHE_HOME" && bv -u
  54. }
  55. # safety features
  56. alias rm='rm -i'
  57. alias cp='cp -i'
  58. alias mv='mv -i'
  59. # git aliases
  60. alias gsetkey="git config --add --local core.sshCommand \'ssh -i \$GIT_SSH_KEY\'"
  61. alias clone="git clone -c core.sshCommand='/usr/bin/ssh -i \$GIT_SSH_KEY'"
  62. alias gs='showgitmessage; git status'
  63. alias gd='git diff'
  64. alias gr='git remote -v'
  65. alias add='git add'
  66. alias commit='git commit'
  67. alias fetch='git fetch'
  68. alias pull='git pull'
  69. alias push='git push'
  70. alias log='git log'
  71. alias remote='git remote'
  72. alias tag='git tag'
  73. alias checkout='git checkout'
  74. alias merge='git merge'
  75. alias branch='git branch'
  76. alias lsc='git log --graph --oneline --decorate --all'
  77. alias lsb="git log --graph --simplify-by-decoration --pretty=format:'%d' --all"
  78. alias lst="git log --graph --decorate --all --date=short --abbrev-commit --oneline --pretty=format:'%h%x09%an%x09%ad%x09%s'"
  79. # ~/ cleanup
  80. alias yarn="yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config"
  81. alias xbindkeys="xbindkeys -f $XDG_CONFIG_HOME/xbindkeys/config"
  82. alias abook="abook --config $XDG_CONFIG_HOME/abook/abookrc --datafile $XDG_DATA_HOME/abook/addressbook"
  83. # always open st in non-interactive mode
  84. alias nst="st > /dev/null 2> /dev/null &disown"
  85. # sane ytdl shortcuts
  86. alias yt="youtube-dl --add-metadata -i"
  87. alias yta="yt -x -f bestaudio/best/140"
  88. alias ytas='yta "$(paste | sed "s/\?.*$//")"'
  89. # imagemagick shortcuts
  90. alias dpi="identify -format '%x\n' -units PixelsPerInch"
  91. alias rmexif="exiftool -overwrite_original -all="
  92. alias lf='lfub'
  93. alias loc='find -type f | grep -v "README\|\.git\|LICENSE" | xargs wc -l | sort -h'
  94. # fast dir switching
  95. s() {
  96. cd "$(ls -d ~/.local/src/* | fzf)"
  97. }
  98. b() {
  99. file="$(ls ~/.local/bin/* | fzf)"
  100. [ -n "$file" ] && "$EDITOR" "$file"
  101. }
  102. c() {
  103. pushd "$HOME/.local/src/dotfiles" > /dev/null || exit 1
  104. file="$(find dot-config -type f | fzf)"
  105. [ -n "$file" ] &&
  106. "$EDITOR" "${file/dot-config\//${XDG_CONFIG_HOME:-$HOME/.config}/}"
  107. popd > /dev/null
  108. }
  109. alias uppkg='git commit -m "uppkg -> $(raw_pkgver="$(grep "^\s*epoch\|^\s*pkgver\|^\s*pkgrel" .SRCINFO | sed "/^\s*epoch/ {s/:$/::/;t;s/$/:/}; s/^\s*epoch\s*=\s*//; s/^\s*pkgver\s*=\s*//; s/^\s*pkgrel\s*=\s*/-/")"; if echo "$raw_pkgver" | grep -q ":"; then raw_pkgver="$(echo "$raw_pkgver" | sed "1{N;h;d};3G")"; fi; echo "$raw_pkgver" | tr -d "\n")"'
  110. # useful extended system aliases
  111. alias perm="stat -c \"%a %n\" --"
  112. installedsize() {
  113. pacman -Qi | egrep '^(Name|Installed)' | cut -f2 -d':' | sed 's/^ //' | \
  114. grep -A1 "$1" | grep -v "\-\-" | \
  115. awk '{ printf "%s%s", $0, (NR%2==1 ? FS : RS) }' | column -t
  116. }
  117. etouch() {
  118. [ -n "$1" ] && touch "$1" chmod +x "$1"
  119. }
  120. evim() {
  121. [ -n "$1" ] && touch "$1" && chmod +x "$1" && v "$1"
  122. }
  123. mkcd() {
  124. [ -n "$1" ] && mkdir "$1" && cd "$1"
  125. }
  126. # more non-system essential aliases
  127. djangokeygen() { python -c 'from django.core.management.utils import get_random_secret_key; \
  128. print(get_random_secret_key())' || pip install django
  129. }
  130. alias ab='[ -f nohup.out ] && rm -f nohup.out; nohup reportbuild &!'
  131. alias abx='[ -f nohup.out ] && rm -f nohup.out; nohup reportbuild -x &!'
  132. alias abc='[ -f nohup.out ] && rm -f nohup.out; nohup reportbuild -c &!'
  133. alias abx='[ -f nohup.out ] && rm -f nohup.out; nohup reportbuild -x &!'
  134. alias abcx='[ -f nohup.out ] && rm -f nohup.out; nohup reportbuild -c -x &!'
  135. alias cb="sudo GNUPGHOME=$XDG_DATA_HOME/gnupg ccm64 s"
  136. alias rep="sudo GNUPGHOME=$XDG_DATA_HOME/gnupg makerepropkg -d"