aliasrc 4.0 KB

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