alias.zsh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. else
  43. alias slog="tail -n 60 -f /var/log/syslog"
  44. alias mlog="tail -n 60 -f /var/log/mail.log"
  45. fi
  46. # using colortail if available (freebsd)
  47. if -exe colortail; then
  48. alias slog="colortail -n 60 -k /usr/local/share/examples/colortail/conf.messages -f /var/log/syslog"
  49. fi
  50. #
  51. # System tools aliases
  52. #
  53. alias df='df -h'
  54. if -exe pydf; then
  55. alias df="pydf -h"
  56. fi
  57. #
  58. # Devel tools aliases
  59. #
  60. if -exe colordiff; then
  61. diff='colordiff'
  62. if -exe tput; then
  63. alias cdiff='colordiff -yW$(tput cols)'
  64. fi
  65. fi
  66. if -exe colormake; then
  67. alias make="colormake"
  68. fi
  69. #
  70. # Git stuff
  71. #
  72. if [ -z "$GIT_PAGER" ]; then
  73. for p in less more cat; do
  74. if -exe "$p"; then
  75. alias git="PAGER=$p git"
  76. break
  77. fi
  78. done
  79. fi