init.zsh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #
  2. # Configures history options
  3. #
  4. # sets the location of the history file
  5. HISTFILE="${ZDOTDIR:-${HOME}}/.zhistory"
  6. # limit of history entries
  7. HISTSIZE=10000
  8. SAVEHIST=10000
  9. # Perform textual history expansion, csh-style, treating the character ‘!’ specially.
  10. setopt BANG_HIST
  11. # Save each command’s beginning timestamp (in seconds since the epoch) and the duration (in seconds) to the history file.
  12. # ‘: <beginning time>:<elapsed seconds>;<command>’.
  13. setopt EXTENDED_HISTORY
  14. # This options works like APPEND_HISTORY except that new history lines are added to the ${HISTFILE} incrementally
  15. # (as soon as they are entered), rather than waiting until the shell exits.
  16. setopt INC_APPEND_HISTORY
  17. # Shares history across all sessions rather than waiting for a new shell invocation to read the history file.
  18. setopt SHARE_HISTORY
  19. # Do not enter command lines into the history list if they are duplicates of the previous event.
  20. setopt HIST_IGNORE_DUPS
  21. # If a new command line being added to the history list duplicates an older one,
  22. # the older command is removed from the list (even if it is not the previous event).
  23. setopt HIST_IGNORE_ALL_DUPS
  24. # Remove command lines from the history list when the first character on the line is a space,
  25. # or when one of the expanded aliases contains a leading space.
  26. setopt HIST_IGNORE_SPACE
  27. # When writing out the history file, older commands that duplicate newer ones are omitted.
  28. setopt HIST_SAVE_NO_DUPS
  29. # Whenever the user enters a line with history expansion, don’t execute the line directly;
  30. # instead, perform history expansion and reload the line into the editing buffer.
  31. setopt HIST_VERIFY
  32. # Lists the ten most used commands.
  33. alias history-stat="history 0 | awk '{print \$2}' | sort | uniq -c | sort -n -r | head"