about summary refs log tree commit diff stats
path: root/bash/history.bash
blob: 95edf9df0f604c23effc971ced9931cbbf561f35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Bash history settings
# I don't export any variables in this file because history settings 
# really only apply in an interactive session.

# XDG compliance
HISTFILE="$XDG_DATA_HOME/bash/history"
mkdir -p "$XDG_DATA_HOME/bash"

# Don't truncate history
HISTFILESIZE=-1 # numeric values less than zero => don't truncate
HISTSIZE=100000 # ideally, I wouldn't truncate at all, but after a while shell
# startup might be affected.

# Append the history to HISTFILE.
shopt -s histappend

# History editing with readline
shopt -s histreedit # allow re-editing of a failed history substitution
shopt -s histverify # verify a history expansion before running it

# Save command invocation time to HISTFILE, and format it thusly
HISTTIMEFORMAT="%F %T "

# Erase all duplicates before saving the current line
HISTCONTROL=erasedups
# Don't save some commands to history
# "'HISTIGNORE' subsumes the function of 'HISTCONTROL'.  A pattern of
# '&' is identical to 'ignoredups', and a pattern of '[ ]*' is
# identical to 'ignorespace'." -- info (bash)Bash Variables
HISTIGNORE='&:[ ]*'
# Other commands to ignore
HISTIGNORE="$HISTIGNORE:ls:exit:cd"

# Automatically append to HISTFILE on every command
PROMPT_COMMAND="history -a; ${PROMPT_COMMAND:-:}"