zshrc 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. for d in $DOTZSHDIR/externals.d/*; do
  43. if [ -f "$d/${d##*/}.zsh" ]; then
  44. source "$d/${d##*/}.zsh"
  45. fi
  46. done
  47. # using 'sudo zsh'
  48. if [ "$SUDO_USER" -a "$UID" = 0 ]; then
  49. # define root history path
  50. export HISTFILE="$DOTZSHDIR/history/history_root"
  51. # ugly hack : reset some file perms to normal to avoid warnings
  52. chmod 0644 ~/.zcompdump
  53. chown "$SUDO_USER:$SUDO_USER" ~/.zcompdump
  54. fi
  55. # sourcing extra file
  56. if [ -r "$DOTZSHDIR/extra.zsh" ]; then
  57. source "$DOTZSHDIR/extra.zsh"
  58. fi