From f73909da2fcb23c092eabafbfcdb1c5b05c80803 Mon Sep 17 00:00:00 2001 From: Nikolas Grottendieck Date: Tue, 28 Jan 2025 20:20:10 +0100 Subject: [PATCH] feat: improve documentation around bash history handling and options --- stow/shell/dot-config/bash/exports | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/stow/shell/dot-config/bash/exports b/stow/shell/dot-config/bash/exports index c233c86b9ab..ae695e1169d 100644 --- a/stow/shell/dot-config/bash/exports +++ b/stow/shell/dot-config/bash/exports @@ -26,11 +26,28 @@ export PYTHONIOENCODING='UTF-8' export GEM_HOME="${XDG_CACHE_HOME}/ruby/gem" # Increase Bash history size. Allow 32³ entries; the default is 500. +# See also +# - https://www.gnu.org/software/bash/manual/html_node/Using-History-Interactively.html +# - https://www.gnu.org/software/bash/manual/html_node/Commands-For-History.html +# - https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html +# The maximum number of commands to remember on the history list. export HISTSIZE='32768' +# The name of the file to which the command history is saved. The default value is ~/.bash_history. export HISTFILE="${XDG_CACHE_HOME}/bash/history" +# The maximum number of lines contained in the history file. export HISTFILESIZE="${HISTSIZE}" -# Omit duplicates and commands that begin with a space from history. Also delete duplicates from the history. +# A colon-separated list of values controlling how commands are saved on the history list. +# - Omit consecutive duplicates and commands that begin with a space from history. export HISTCONTROL='ignoreboth:erasedups' +# A colon-separated list of patterns used to decide which command lines should be saved on the history list. +export HISTIGNORE='' +# See https://github.com/git-for-windows/git/discussions/4071 for details +# TL;DR: This will allow Git Bash to remember the history within Windows Terminal and Visual Studio Code +#export PROMPT_COMMAND="history -a" +# See also shopt settings in ~/.bash_profile, specifically +# shopt -s cmdhist +# shopt -s histappend +# See https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html # Prefer US English and use UTF-8. export LANG='en_US.UTF-8'