diff options
Diffstat (limited to 'bash/history.bash')
-rw-r--r-- | bash/history.bash | 35 |
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 | ||
6 | HISTFILE="$XDG_DATA_HOME/bash/history" | ||
7 | mkdir -p "$XDG_DATA_HOME/bash" | ||
8 | |||
9 | # Don't truncate history | ||
10 | HISTFILESIZE=-1 # numeric values less than zero => don't truncate | ||
11 | HISTSIZE=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. | ||
15 | shopt -s histappend | ||
16 | |||
17 | # History editing with readline | ||
18 | shopt -s histreedit # allow re-editing of a failed history substitution | ||
19 | shopt -s histverify # verify a history expansion before running it | ||
20 | |||
21 | # Save command invocation time to HISTFILE, and format it thusly | ||
22 | HISTTIMEFORMAT="%F %T " | ||
23 | |||
24 | # Erase all duplicates before saving the current line | ||
25 | HISTCONTROL=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 | ||
30 | HISTIGNORE='&:[ ]*' | ||
31 | # Other commands to ignore | ||
32 | HISTIGNORE="$HISTIGNORE:ls:exit:cd" | ||
33 | |||
34 | # Automatically append to HISTFILE on every command | ||
35 | PROMPT_COMMAND="history -a; ${PROMPT_COMMAND:-:}" | ||