alias.zsh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 vim; then
  18. export PAGER=~/.vim/bin/vimpager
  19. alias less="$PAGER"
  20. alias more="$PAGER"
  21. elif -exe most; then
  22. export PAGER=most
  23. alias less="$PAGER"
  24. alias more="$PAGER"
  25. elif -exe less; then
  26. export PAGER=less
  27. elif -exe more; then
  28. export PAGER=more
  29. fi
  30. #
  31. # Common aliases
  32. #
  33. alias rm='rm -i'
  34. alias mv='mv -i'
  35. alias cp='cp -i'
  36. alias vlock='clear;vlock'
  37. alias q='clear;exit'
  38. alias grep="grep --color=tty"
  39. alias mgrep="grep --color=tty -rnisH"
  40. alias rsu="sudo -E zsh"
  41. alias reload="exec zsh"
  42. #
  43. # Log viewers aliases
  44. #
  45. if -exe ccze; then
  46. alias slog="tail -n 300 -f /var/log/syslog | ccze"
  47. alias mlog="tail -n 300 -f /var/log/mail.log | ccze"
  48. alias xlog="tail -n 300 -f /var/log/Xorg.0.log | ccze"
  49. else
  50. alias slog="tail -n 300 -f /var/log/syslog"
  51. alias mlog="tail -n 300 -f /var/log/mail.log"
  52. alias xlog="tail -n 300 -f /var/log/Xorg.0.log"
  53. fi
  54. # using colortail if available (freebsd)
  55. if -exe colortail; then
  56. alias slog="colortail -n 60 -k /usr/local/share/examples/colortail/conf.messages -f /var/log/syslog"
  57. fi
  58. #
  59. # System tools aliases
  60. #
  61. alias df='df -h'
  62. if -exe pydf; then
  63. alias df="pydf -h"
  64. fi
  65. #
  66. # Devel tools aliases
  67. #
  68. if -exe colordiff; then
  69. diff='colordiff'
  70. if -exe tput; then
  71. alias cdiff='colordiff -yW$(tput cols)'
  72. fi
  73. fi
  74. if -exe colormake; then
  75. alias make="colormake"
  76. fi
  77. #
  78. # Git stuff
  79. #
  80. if [ -z "$GIT_PAGER" ]; then
  81. for p in less more cat; do
  82. if -exe "$p"; then
  83. alias git="PAGER=$p git"
  84. break
  85. fi
  86. done
  87. fi