Skip to content

Commit 3dbaea9

Browse files
committed
plugin/history-eternal: Use readonly instead of export
...and hide errors relating to setting already-readonly variables. `plugin/history-eternal` does not need to force loading after `plugin/history` because both plugins will play nicely with read-only variables, and since we're overwritting and marking read-only then the intended result survives no matter which loads first.
1 parent 1daa819 commit 3dbaea9

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
# shellcheck shell=bash
22
about-plugin 'eternal bash history'
33

4-
# Load after the history plugin
5-
# BASH_IT_LOAD_PRIORITY: 375
6-
74
# Modify history sizes before changing location to avoid unintentionally
85
# truncating the history file early.
96

107
# "Numeric values less than zero result in every command being saved on the history list (there is no limit)"
11-
export HISTSIZE=-1
8+
readonly HISTSIZE=-1 2>/dev/null
129

1310
# "Non-numeric values and numeric values less than zero inhibit truncation"
14-
export HISTFILESIZE='unlimited'
11+
readonly HISTFILESIZE='unlimited' 2>/dev/null
1512

1613
# Use a custom history file location so history is not truncated
1714
# if the environment ever loses this "eternal" configuration.
1815
HISTDIR="${XDG_STATE_HOME:-${HOME?}/.local/state}/bash"
1916
[[ -d ${HISTDIR?} ]] || mkdir -p "${HISTDIR?}"
20-
export HISTFILE="${HISTDIR?}/history"
17+
readonly HISTFILE="${HISTDIR?}/history" 2>/dev/null

0 commit comments

Comments
 (0)