summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan <mail@3v1n0.net>2020-06-03 19:34:57 +0200
committerGitHub <noreply@github.com>2020-06-03 19:34:57 +0200
commited4e317bbbd9966da2b4b85893c8d55c9ffbfd66 (patch)
treeb725bdf7c63438313dfc9ab9d9aae41bbde39990
parent82f02e80a669d099d79a531cf8fb6a0e34d4478c (diff)
downloadzsh-ed4e317bbbd9966da2b4b85893c8d55c9ffbfd66.tar.gz
zsh-ed4e317bbbd9966da2b4b85893c8d55c9ffbfd66.tar.bz2
zsh-ed4e317bbbd9966da2b4b85893c8d55c9ffbfd66.zip
lib: don't override bigger HISTSIZE and SAVEHIST values (#8993)
oh-my-zsh Changes the HISTSIZE and SAVEHIST values to fixed sizes, however if a bigger value is set in ~/.zshrc, it will override it, potentially causing the user history to be deleted. So, only set these values if no other is set and if it is lower than the default ones.
-rw-r--r--lib/history.zsh4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/history.zsh b/lib/history.zsh
index 0f04de215..0ee8cfe7a 100644
--- a/lib/history.zsh
+++ b/lib/history.zsh
@@ -27,8 +27,8 @@ esac
## History file configuration
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
-HISTSIZE=50000
-SAVEHIST=10000
+[ "$HISTSIZE" -lt 50000 ] && HISTSIZE=50000
+[ "$SAVEHIST" -lt 10000 ] && SAVEHIST=10000
## History command configuration
setopt extended_history # record timestamp of command in HISTFILE