alias.zsh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #
  2. # Editor
  3. #
  4. if -exe emacs; then
  5. export EDITOR='emacs -nw'
  6. fi
  7. if [ -n "$EDITOR" -a -n "$SUDO_USER" -a "$UID" = 0 -a "$EDITOR[1,5]" = 'emacs' ]; then
  8. e="$EDITOR -u $SUDO_USER"
  9. else
  10. alias e=$EDITOR
  11. fi
  12. #
  13. # Pager
  14. #
  15. if -exe most; then
  16. export PAGER=most
  17. alias less='most'
  18. alias more='most'
  19. elif -exe less; then
  20. export PAGER=less
  21. elif -exe more; then
  22. export PAGER=more
  23. fi
  24. #
  25. # Common aliases
  26. #
  27. alias rm='rm -i'
  28. alias mv='mv -i'
  29. alias cp='cp -i'
  30. alias vlock='clear;vlock'
  31. alias q='clear;exit'
  32. alias grep="grep --color=tty"
  33. alias mgrep="grep --color=tty -rnisH"
  34. alias rsu="sudo zsh"
  35. alias reload="exec zsh"
  36. #
  37. # Log viewers aliases
  38. #
  39. if -exe ccze; then
  40. alias slog="tail -n 300 -f /var/log/syslog | ccze"
  41. alias mlog="tail -n 300 -f /var/log/mail.log | ccze"
  42. alias xlog="tail -n 300 -f /var/log/Xorg.0.log | ccze"
  43. else
  44. alias slog="tail -n 300 -f /var/log/syslog"
  45. alias mlog="tail -n 300 -f /var/log/mail.log"
  46. alias xlog="tail -n 300 -f /var/log/Xorg.0.log"
  47. fi
  48. # using colortail if available (freebsd)
  49. if -exe colortail; then
  50. alias slog="colortail -n 60 -k /usr/local/share/examples/colortail/conf.messages -f /var/log/syslog"
  51. fi
  52. #
  53. # System tools aliases
  54. #
  55. alias df='df -h'
  56. if -exe pydf; then
  57. alias df="pydf -h"
  58. fi
  59. #
  60. # Devel tools aliases
  61. #
  62. if -exe colordiff; then
  63. diff='colordiff'
  64. if -exe tput; then
  65. alias cdiff='colordiff -yW$(tput cols)'
  66. fi
  67. fi
  68. if -exe colormake; then
  69. alias make="colormake"
  70. fi
  71. #
  72. # Git stuff
  73. #
  74. if [ -z "$GIT_PAGER" ]; then
  75. for p in less more cat; do
  76. if -exe "$p"; then
  77. alias git="PAGER=$p git"
  78. break
  79. fi
  80. done
  81. fi