dotfiles/home/dot-local/share/bash/history.sh

34 lines
855 B
Bash
Raw Normal View History

2022-02-03 18:33:04 +00:00
# -*- mode: bash -*-
# append to the history file, don't overwrite it
shopt -s histappend
# save multi-line commands as one command
shopt -s cmdhist
# use readline on history
shopt -s histreedit
# load history line onto readline buffer for editing
shopt -s histverify
# use standard ISO 8601 timestamp
# %F equivalent to %Y-%m-%d
# %T equivalent to %H:%M:%S (24-hours format)
TIME_LONG='%F %T'
TIME_DEFAULT="${TIME_LONG}"
HISTCONTROL="erasedups:ignoredups:ignorespace"
HISTSIZE=500000
HISTFILESIZE="${HISTSIZE}"
HISTFILE="${HOME}/.local/state/bash/history"
HISTTIMEFORMAT="${TIME_DEFAULT} "
export HISTFILE HISTSIZE HISTFILESIZE HISTCONTROL HISTTIMEFORMAT
# enable incremental history search with up/down arrows
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
bind '"\e[C": forward-char'
bind '"\e[D": backward-char'