about summary refs log tree commit diff
path: root/.config/zsh/history.zsh
blob: 162be39e39a989d6ed43fe645649cc31c0f4a9d0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# history
HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history
HISTSIZE=10000
SAVEHIST=$HISTSIZE
setopt hist_ignore_space    # add leading space to hide from history
setopt hist_ignore_dups     # deduplicate commands run twice in a row
setopt hist_ignore_all_dups # deduplicate entire history file
setopt hist_reduce_blanks   # trim
setopt hist_verify          # confirm before executing
setopt share_history        # import all of history in new sessions

# search all of history, or display just the last 16 like the builtin `history`
function h () {
	[ $# -eq 0 ] &&\
		fc -l ||\
		fc -l 0 | grep "$*"
}