alias.zsh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. alias tmux="tmux -2"
  43. #
  44. # Log viewers aliases
  45. #
  46. if -exe ccze; then
  47. alias slog="tail -n 300 -f /var/log/syslog | ccze"
  48. alias mlog="tail -n 300 -f /var/log/mail.log | ccze"
  49. alias xlog="tail -n 300 -f /var/log/Xorg.0.log | ccze"
  50. else
  51. alias slog="tail -n 300 -f /var/log/syslog"
  52. alias mlog="tail -n 300 -f /var/log/mail.log"
  53. alias xlog="tail -n 300 -f /var/log/Xorg.0.log"
  54. fi
  55. # using colortail if available (freebsd)
  56. if -exe colortail; then
  57. alias slog="colortail -n 60 -k /usr/local/share/examples/colortail/conf.messages -f /var/log/syslog"
  58. fi
  59. #
  60. # System tools aliases
  61. #
  62. alias df='df -h'
  63. if -exe pydf; then
  64. alias df="pydf -h"
  65. fi
  66. #
  67. # Devel tools aliases
  68. #
  69. if -exe colordiff; then
  70. diff='colordiff'
  71. if -exe tput; then
  72. alias cdiff='colordiff -yW$(tput cols)'
  73. fi
  74. fi
  75. if -exe colormake; then
  76. alias make="colormake"
  77. fi
  78. #
  79. # Git stuff
  80. #
  81. if [ -z "$GIT_PAGER" ]; then
  82. for p in less more cat; do
  83. if -exe "$p"; then
  84. alias git="PAGER=$p git"
  85. break
  86. fi
  87. done
  88. fi
  89. #
  90. # Mssh stuff
  91. #
  92. if [ -f ~/.ssh/config ]; then
  93. hosts=($(grep '^Host [^*]' ~/.ssh/config | sed 's/Host //'))
  94. compctl -k hosts mssh
  95. fi