zshrc 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. # using 'sudo zsh'
  42. if [ "$SUDO_USER" -a "$UID" = 0 ]; then
  43. # define root history path
  44. export HISTFILE="$DOTZSHDIR/history/history_root"
  45. # ugly hack : reset some file perms to normal to avoid warnings
  46. chmod 0644 ~/.zcompdump
  47. chown "$SUDO_USER:$SUDO_USER" ~/.zcompdump
  48. fi
  49. # sourcing extra file
  50. if [ -r "$DOTZSHDIR/extra.zsh" ]; then
  51. source "$DOTZSHDIR/extra.zsh"
  52. fi