Skip to content

Commit

Permalink
plugins/history: Add autoshare to $HISTCONTROL
Browse files Browse the repository at this point in the history
  • Loading branch information
gaelicWizard committed Dec 27, 2021
1 parent e5bc053 commit ccfda10
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions plugins/available/history.plugin.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ 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}"

safe_append_preexec '_bash_it_history_auto_save'
safe_append_prompt_command '_bash_it_history_auto_load'

# 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'

Expand Down

0 comments on commit ccfda10

Please sign in to comment.