浏览代码

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.
Marco Trevisan 4 年之前
父节点
当前提交
ed4e317bbb
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      lib/history.zsh

+ 2 - 2
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