.zshrc 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 ZSHDOTDIR="${HOME}/.zsh"
  10. # redefine PATH
  11. export PATH="${HOME}/bin:${HOME}/.bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
  12. # load prezto
  13. BUNDLES_ROOT="${ZSHDOTDIR}/bundles"
  14. PREZTO_INIT="${BUNDLES_ROOT}/prezto/init.zsh"
  15. OVERRIDES_ROOT="${ZSHDOTDIR}/overrides"
  16. OVERRIDES_PREZTO_INIT="${OVERRIDES_ROOT}/prezto/init.zsh"
  17. if [ -f "${PREZTO_INIT}" ]; then
  18. export ZDOTDIR="${BUNDLES_ROOT}"
  19. source "${PREZTO_INIT}"
  20. export ZDOTDIR="${OVERRIDES_ROOT}"
  21. source "${OVERRIDES_PREZTO_INIT}"
  22. unset ZDOTDIR
  23. fi
  24. unset BUNDLES_ROOT PREZTO_INIT OVERRIDES_ROOT OVERRIDES_PREZTO_INIT
  25. # overide insecure stuff with compinit while using 'sudo zsh'
  26. # my functions (don't forget to modify fpath before call compinit !!)
  27. #if [ -z "$SUDO_USER" -a "$UID" != 0 ]; then
  28. # fpath=($ZSHDOTDIR/functions.d $fpath)
  29. #fi
  30. # include custom configuration
  31. for f in ${ZSHDOTDIR}/config/*.zsh; do
  32. if [[ -r "${f}" ]]; then
  33. . "${f}"
  34. fi
  35. done
  36. # using 'sudo zsh'
  37. if [ "$SUDO_USER" -a "$UID" = 0 ]; then
  38. # define root history path
  39. export HISTFILE="$ZSHDOTDIR/history/history_root"
  40. # ugly hack : reset some file perms to normal to avoid warnings
  41. chmod 0644 ~/.zcompdump
  42. chown "$SUDO_USER:$SUDO_USER" ~/.zcompdump
  43. fi