init.zsh 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #
  2. # Sets general shell options and defines environment variables.
  3. #
  4. # Authors:
  5. # Sorin Ionescu <sorin.ionescu@gmail.com>
  6. #
  7. #
  8. # Smart URLs
  9. #
  10. # This logic comes from an old version of zim. Essentially, bracketed-paste was
  11. # added as a requirement of url-quote-magic in 5.1, but in 5.1.1 bracketed
  12. # paste had a regression. Additionally, 5.2 added bracketed-paste-url-magic
  13. # which is generally better than url-quote-magic so we load that when possible.
  14. autoload -Uz is-at-least
  15. if [[ ${ZSH_VERSION} != 5.1.1 && ${TERM} != "dumb" ]]; then
  16. if is-at-least 5.2; then
  17. autoload -Uz bracketed-paste-url-magic
  18. zle -N bracketed-paste bracketed-paste-url-magic
  19. elif is-at-least 5.1; then
  20. autoload -Uz bracketed-paste-magic
  21. zle -N bracketed-paste bracketed-paste-magic
  22. fi
  23. autoload -Uz url-quote-magic
  24. zle -N self-insert url-quote-magic
  25. fi
  26. #
  27. # General
  28. #
  29. setopt COMBINING_CHARS # Combine zero-length punctuation characters (accents)
  30. # with the base character.
  31. setopt INTERACTIVE_COMMENTS # Enable comments in interactive shell.
  32. setopt RC_QUOTES # Allow 'Henry''s Garage' instead of 'Henry'\''s Garage'.
  33. unsetopt MAIL_WARNING # Don't print a warning message if a mail file has been accessed.
  34. # Allow mapping Ctrl+S and Ctrl+Q shortcuts
  35. [[ -r ${TTY:-} && -w ${TTY:-} && $+commands[stty] == 1 ]] && stty -ixon <$TTY >$TTY
  36. #
  37. # Jobs
  38. #
  39. setopt LONG_LIST_JOBS # List jobs in the long format by default.
  40. setopt AUTO_RESUME # Attempt to resume existing job before creating a new process.
  41. setopt NOTIFY # Report status of background jobs immediately.
  42. unsetopt BG_NICE # Don't run all background jobs at a lower priority.
  43. unsetopt HUP # Don't kill jobs on shell exit.
  44. unsetopt CHECK_JOBS # Don't report on jobs when shell exit.
  45. #
  46. # Termcap
  47. #
  48. if zstyle -t ':prezto:environment:termcap' color; then
  49. export LESS_TERMCAP_mb=$'\E[01;31m' # Begins blinking.
  50. export LESS_TERMCAP_md=$'\E[01;31m' # Begins bold.
  51. export LESS_TERMCAP_me=$'\E[0m' # Ends mode.
  52. export LESS_TERMCAP_se=$'\E[0m' # Ends standout-mode.
  53. export LESS_TERMCAP_so=$'\E[00;47;30m' # Begins standout-mode.
  54. export LESS_TERMCAP_ue=$'\E[0m' # Ends underline.
  55. export LESS_TERMCAP_us=$'\E[01;32m' # Begins underline.
  56. fi