aliasrc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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 add='git add'
  61. alias commit='git commit'
  62. alias fetch='git fetch'
  63. alias pull='git pull'
  64. alias push='git push'
  65. alias log='git log'
  66. alias remote='git remote'
  67. alias tag='git tag'
  68. alias checkout='git checkout'
  69. alias merge='git merge'
  70. alias branch='git branch'
  71. alias lsc='git log --graph --oneline --decorate --all'
  72. alias lsb="git log --graph --simplify-by-decoration --pretty=format:'%d' --all"
  73. alias lst="git log --graph --decorate --all --date=short --abbrev-commit --oneline --pretty=format:'%h%x09%an%x09%ad%x09%s'"
  74. # ~/ cleanup
  75. alias yarn="yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config"
  76. alias xbindkeys="xbindkeys -f $XDG_CONFIG_HOME/xbindkeys/config"
  77. alias abook="abook --config $XDG_CONFIG_HOME/abook/abookrc --datafile $XDG_DATA_HOME/abook/addressbook"
  78. # always open st in non-interactive mode
  79. alias nst="st > /dev/null 2> /dev/null &disown"
  80. # sane ytdl shortcuts
  81. alias yt="youtube-dl --add-metadata -i"
  82. alias yta="yt -x -f 140/bestaudio/best"
  83. # imagemagick shortcuts
  84. alias dpi="identify -format '%x\n' -units PixelsPerInch"
  85. alias rmexif="exiftool -overwrite_original -all="
  86. alias lf='lfub'
  87. alias loc='find -type f | xargs wc -l | sort -h'
  88. # fast dir switching
  89. s() {
  90. cd "$(ls -d ~/.local/src/* | fzf)"
  91. }
  92. b() {
  93. file="$(ls ~/.local/bin/* | fzf)"
  94. [ -n "$file" ] && "$EDITOR" "$file"
  95. }
  96. c() {
  97. pushd "$HOME/.local/src/dotfiles" > /dev/null || exit 1
  98. file="$(find dot-config -type f | fzf)"
  99. [ -n "$file" ] &&
  100. "$EDITOR" "${file/dot-config\//${XDG_CONFIG_HOME:-$HOME/.config}/}"
  101. popd > /dev/null
  102. }
  103. alias uppkg='git commit -m "uppkg -> $(grep "^pkgver=\|^pkgrel=" PKGBUILD | sed "s/^pkgver=//; s/^pkgrel=/-/"| tr -d "\n")"'
  104. # useful extended system aliases
  105. alias perm="stat -c \"%a %n\" --"
  106. installedsize() {
  107. pacman -Qi | egrep '^(Name|Installed)' | cut -f2 -d':' | sed 's/^ //' | \
  108. grep -A1 "$1" | grep -v "\-\-" | \
  109. awk '{ printf "%s%s", $0, (NR%2==1 ? FS : RS) }' | column -t
  110. }
  111. etouch() {
  112. [ -n "$1" ] && touch "$1" chmod +x "$1"
  113. }
  114. evim() {
  115. [ -n "$1" ] && touch "$1" && chmod +x "$1" && v "$1"
  116. }
  117. mkcd() {
  118. [ -n "$1" ] && mkdir "$1" && cd "$1"
  119. }
  120. # more non-system essential aliases
  121. djangokeygen() { python -c 'from django.core.management.utils import get_random_secret_key; \
  122. print(get_random_secret_key())' || pip install django
  123. }