lib/history: new functions _bash-it-history-auto-*()

Two new functions `_bash-it-history-auto-save()` and `_bash-it-history-auto-load()`, which append new history to disk and load new history from disk, respectively.

See bash-it/bash-it#1595 for discussion.
This commit is contained in:
John D Pell
2022-01-24 21:37:04 -08:00
parent f6119567e8
commit 5d5858058e
4 changed files with 57 additions and 7 deletions

View File

@@ -5,15 +5,14 @@ about-plugin 'improve history handling with sane defaults'
# variable when the shell exits, rather than overwriting the file.
shopt -s histappend
# erase duplicates; alternative option: HISTCONTROL=ignoredups
: "${HISTCONTROL:=ignorespace:erasedups}"
# 'ignorespace': don't save command lines which begin with a space to history
# 'erasedups' (alternative 'ignoredups'): don't save duplicates to history
# 'autoshare': automatically share history between multiple running shells
: "${HISTCONTROL:=ignorespace:erasedups:autoshare}"
# resize history to 100x the default (500)
: "${HISTSIZE:=50000}"
# Flush history to disk after each command.
export PROMPT_COMMAND="history -a;${PROMPT_COMMAND}"
function top-history() {
about 'print the name and count of the most commonly run tools'