alias.zsh 1.7 KB

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