improve history

This commit is contained in:
Yax 2022-11-03 15:20:17 +01:00
parent 29445f479e
commit 8af513b64e
2 changed files with 40 additions and 24 deletions

View file

@ -14,16 +14,7 @@
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
@ -143,9 +134,28 @@ if [ -d "$HOME/.bashrc.d/" ]; then
done
fi
# replace fzf history (CTRL-R) by https://github.com/cantino/mcfly
if hash mcfly 2>/dev/null; then
eval "$(mcfly init bash)"
fi
# ---------------------------------------------------------------------------
# History
# ---------------------------------------------------------------------------
set -o history
#unset HISTFILE
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# store multiline commands
shopt -s cmdhist
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=2000
HISTFILESIZE=2000
# don't story history commands
HISTIGNORE=history*
# merge history b/w sessions
PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"