aliasrc 4.9 KB

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