Skip to content

Commit 1bade50

Browse files
committed
feat: improve documentation around bash history handling and options
1 parent 85ef6bb commit 1bade50

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

stow/shell/.config/bash/exports

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,28 @@ export NODE_REPL_MODE='sloppy'
2222
export PYTHONIOENCODING='UTF-8'
2323

2424
# Increase Bash history size. Allow 32³ entries; the default is 500.
25+
# See also
26+
# - https://www.gnu.org/software/bash/manual/html_node/Using-History-Interactively.html
27+
# - https://www.gnu.org/software/bash/manual/html_node/Commands-For-History.html
28+
# - https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html
29+
# The maximum number of commands to remember on the history list.
2530
export HISTSIZE='32768'
31+
# The name of the file to which the command history is saved. The default value is ~/.bash_history.
2632
export HISTFILE="${XDG_CACHE_HOME}/bash/history"
33+
# The maximum number of lines contained in the history file.
2734
export HISTFILESIZE="${HISTSIZE}"
28-
# Omit duplicates and commands that begin with a space from history. Also delete duplicates from the history.
35+
# A colon-separated list of values controlling how commands are saved on the history list.
36+
# - Omit consecutive duplicates and commands that begin with a space from history.
2937
export HISTCONTROL='ignoreboth:erasedups'
38+
# A colon-separated list of patterns used to decide which command lines should be saved on the history list.
39+
export HISTIGNORE=''
40+
# See https://github.com/git-for-windows/git/discussions/4071 for details
41+
# TL;DR: This will allow Git Bash to remember the history within Windows Terminal and Visual Studio Code
42+
export PROMPT_COMMAND="history -a"
43+
# See also shopt settings in ~/.bash_profile, specifically
44+
# shopt -s cmdhist
45+
# shopt -s histappend
46+
# See https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html
3047

3148
# Prefer US English and use UTF-8.
3249
export LANG='en_US.UTF-8'
@@ -59,7 +76,3 @@ export RIPGREP_CONFIG_PATH="${XDG_CONFIG_HOME}/ripgreprc"
5976
# Override the SSH Auth Socket for KeePass + KeeAgent compatibility with either of these; Cygwin usually works
6077
#export SSH_AUTH_SOCK=~/.ssh/cygwin.socket
6178
#export SSH_AUTH_SOCK=~/.ssh/msysgit.socket
62-
63-
# See https://github.com/git-for-windows/git/discussions/4071 for details
64-
# TL;DR: This will allow Git Bash to remember the history within Windows Terminal and Visual Studio Code
65-
export PROMPT_COMMAND="history -a"

0 commit comments

Comments
 (0)