SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## History wrapper
  2. function omz_history {
  3.   local clear list
  4.   zparseopts -E c=clear l=list
  5.  
  6.   if [[ -n "$clear" ]]; then
  7.     # if -c provided, clobber the history file
  8.     echo -n >| "$HISTFILE"
  9.     echo >&2 History file deleted. Reload the session to see its effects.
  10.   elif [[ -n "$list" ]]; then
  11.     # if -l provided, run as if calling `fc' directly
  12.     builtin fc "$@"
  13.   else
  14.     # unless a number is provided, show all history events (starting from 1)
  15.     [[ ${@[-1]} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
  16.   fi
  17. }
  18.  
  19. # Timestamp format
  20. case $HIST_STAMPS in
  21.   "mm/dd/yyyy") alias history='omz_history -f' ;;
  22.   "dd.mm.yyyy") alias history='omz_history -E' ;;
  23.   "yyyy-mm-dd") alias history='omz_history -i' ;;
  24.   "") alias history='omz_history' ;;
  25.   *) alias history="omz_history -t '$HIST_STAMPS'" ;;
  26. esac
  27.  
  28. ## History file configuration
  29. [ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
  30. HISTSIZE=50000
  31. SAVEHIST=10000
  32.  
  33. ## History command configuration
  34. setopt extended_history       # record timestamp of command in HISTFILE
  35. setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
  36. setopt hist_ignore_dups       # ignore duplicated commands history list
  37. setopt hist_ignore_space      # ignore commands that start with space
  38. setopt hist_verify            # show command with history expansion to user before running it
  39. setopt inc_append_history     # add commands to HISTFILE in order of execution
  40. setopt share_history          # share command history data
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top