zshrc 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #
  2. # Zsh configuration file
  3. # Since 2006, kolter <kolter@openics.org>
  4. #
  5. # This file is distributed in the hope that it will be useful,
  6. # but WITHOUT ANY WARRANTY
  7. #
  8. # define personal zsh config directory
  9. export DOTZSHDIR="$HOME/.zsh.d"
  10. # redefine PATH
  11. export PATH=$HOME/bin:$DOTZSHDIR/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin:/usr/games
  12. # overide insecure stuff with compinit while using 'sudo zsh'
  13. # my functions (don't forget to modify fpath before call compinit !!)
  14. if [ -z "$SUDO_USER" -a "$UID" != 0 ]; then
  15. fpath=($DOTZSHDIR/functions.d $fpath)
  16. fi
  17. autoload -U zutil
  18. autoload -U compinit
  19. autoload -U complist
  20. compinit
  21. # include custom functions
  22. for f in $DOTZSHDIR/lib.d/*.zsh; do
  23. [ -r "$f" ] && source $f
  24. done
  25. # per OS resource file
  26. os=$(uname)
  27. # special case
  28. if [ "$os" = "GNU/kFreeBSD" ]; then
  29. os="Linux"
  30. fi
  31. if [ -r "$DOTZSHDIR/os.d/${os}.zsh" ]; then
  32. source "$DOTZSHDIR/os.d/${os}.zsh"
  33. fi
  34. unset os
  35. # sourcing config files
  36. for f in $DOTZSHDIR/config.d/*.zsh ; do
  37. if [ -r "$f" ]; then
  38. source $f
  39. fi
  40. done
  41. # sourcing externals plugins
  42. # some features are not well supported by zsh <= 4.3.6
  43. if [ "$(printf "%02d%02d%02d" $(echo ${ZSH_VERSION:gs/./ /}))" -gt "040306" ]; then
  44. for d in $DOTZSHDIR/externals.d/*; do
  45. if [ -f "$d/${d##*/}.zsh" ]; then
  46. source "$d/${d##*/}.zsh"
  47. fi
  48. done
  49. fi
  50. # using 'sudo zsh'
  51. if [ "$SUDO_USER" -a "$UID" = 0 ]; then
  52. # define root history path
  53. export HISTFILE="$DOTZSHDIR/history/history_root"
  54. # ugly hack : reset some file perms to normal to avoid warnings
  55. chmod 0644 ~/.zcompdump
  56. chown "$SUDO_USER:$SUDO_USER" ~/.zcompdump
  57. fi
  58. # sourcing extra file
  59. if [ -r "$DOTZSHDIR/extra.zsh" ]; then
  60. source "$DOTZSHDIR/extra.zsh"
  61. fi