about summary refs log tree commit diff stats
path: root/bash/history.bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash/history.bash')
-rw-r--r--bash/history.bash35
1 files changed, 35 insertions, 0 deletions
diff --git a/bash/history.bash b/bash/history.bash new file mode 100644 index 0000000..95edf9d --- /dev/null +++ b/bash/history.bash
@@ -0,0 +1,35 @@
1# Bash history settings
2# I don't export any variables in this file because history settings
3# really only apply in an interactive session.
4
5# XDG compliance
6HISTFILE="$XDG_DATA_HOME/bash/history"
7mkdir -p "$XDG_DATA_HOME/bash"
8
9# Don't truncate history
10HISTFILESIZE=-1 # numeric values less than zero => don't truncate
11HISTSIZE=100000 # ideally, I wouldn't truncate at all, but after a while shell
12# startup might be affected.
13
14# Append the history to HISTFILE.
15shopt -s histappend
16
17# History editing with readline
18shopt -s histreedit # allow re-editing of a failed history substitution
19shopt -s histverify # verify a history expansion before running it
20
21# Save command invocation time to HISTFILE, and format it thusly
22HISTTIMEFORMAT="%F %T "
23
24# Erase all duplicates before saving the current line
25HISTCONTROL=erasedups
26# Don't save some commands to history
27# "'HISTIGNORE' subsumes the function of 'HISTCONTROL'. A pattern of
28# '&' is identical to 'ignoredups', and a pattern of '[ ]*' is
29# identical to 'ignorespace'." -- info (bash)Bash Variables
30HISTIGNORE='&:[ ]*'
31# Other commands to ignore
32HISTIGNORE="$HISTIGNORE:ls:exit:cd"
33
34# Automatically append to HISTFILE on every command
35PROMPT_COMMAND="history -a; ${PROMPT_COMMAND:-:}"