init.zsh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #
  2. # Configures history options
  3. #
  4. # The file to save the history in.
  5. HISTFILE="${ZDOTDIR:-${HOME}}/.zhistory"
  6. # The maximum number of events stored in the internal history list and in the history file.
  7. HISTSIZE=10000
  8. SAVEHIST=10000
  9. # Perform textual history expansion, csh-style, treating the character ‘!’ specially.
  10. setopt BANG_HIST
  11. # This option both imports new commands from the history file, and also causes your
  12. # typed commands to be appended to the history file (like specifying INC_APPEND_HISTORY).
  13. # The history lines are also output with timestamps ala EXTENDED_HISTORY.
  14. setopt SHARE_HISTORY
  15. # Do not enter command lines into the history list if they are duplicates of the previous event.
  16. setopt HIST_IGNORE_DUPS
  17. # If a new command line being added to the history list duplicates an older one,
  18. # the older command is removed from the list (even if it is not the previous event).
  19. setopt HIST_IGNORE_ALL_DUPS
  20. # Remove command lines from the history list when the first character on the
  21. # line is a space, or when one of the expanded aliases contains a leading space.
  22. setopt HIST_IGNORE_SPACE
  23. # When writing out the history file, older commands that duplicate newer ones are omitted.
  24. setopt HIST_SAVE_NO_DUPS
  25. # Whenever the user enters a line with history expansion, don't execute the line directly;
  26. # instead, perform history expansion and reload the line into the editing buffer.
  27. setopt HIST_VERIFY
  28. # Lists the ten most used commands.
  29. alias history-stat="fc -ln 0 | awk '{print \$1}' | sort | uniq -c | sort -nr | head"