init.zsh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #
  2. # Sets history options and defines history aliases.
  3. #
  4. # Authors:
  5. # Robby Russell <robby@planetargon.com>
  6. # Sorin Ionescu <sorin.ionescu@gmail.com>
  7. #
  8. #
  9. # Options
  10. #
  11. setopt BANG_HIST # Treat the '!' character specially during expansion.
  12. setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format.
  13. setopt SHARE_HISTORY # Share history between all sessions.
  14. setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history.
  15. setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again.
  16. setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate.
  17. setopt HIST_FIND_NO_DUPS # Do not display a previously found event.
  18. setopt HIST_IGNORE_SPACE # Do not record an event starting with a space.
  19. setopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file.
  20. setopt HIST_VERIFY # Do not execute immediately upon history expansion.
  21. setopt HIST_BEEP # Beep when accessing non-existent history.
  22. #
  23. # Variables
  24. #
  25. zstyle -s ':prezto:module:history' histfile 'HISTFILE' \
  26. || HISTFILE="${HISTFILE:-${ZDOTDIR:-$HOME}/.zsh_history}" # The path to the history file.
  27. zstyle -s ':prezto:module:history' histsize 'HISTSIZE' \
  28. || HISTSIZE=10000 # The maximum number of events to save in the internal history.
  29. zstyle -s ':prezto:module:history' savehist 'SAVEHIST' \
  30. || SAVEHIST=$HISTSIZE # The maximum number of events to save in the history file.
  31. #
  32. # Aliases
  33. #
  34. if ! zstyle -t ':prezto:module:history:alias' skip; then
  35. # Lists the ten most used commands.
  36. alias history-stat="history 0 | awk '{print \$2}' | sort | uniq -c | sort -n -r | head"
  37. fi