diff --git a/share/initialization/common b/share/initialization/common index 997556d3..168681a5 100644 --- a/share/initialization/common +++ b/share/initialization/common @@ -183,21 +183,18 @@ fi # variables needed for command history -HISTFILE=${XDG_STATE_HOME:-~/.local/state}/yash/history -HISTSIZE=5000 - - -# handle old yash history directory -if [ -f "$HOME/.yash_history" ] && [ -z "$HISTFILE" ]; then - echo 'warning: Yash does not read $HOME/.yash_history by default, please set - $HISTFILE to $XDG_STATE_HOME/yash/history' - HISTFILE="$HOME/.yash_history" +if ! [ "${HISTFILE-}" ]; then + HISTFILE=${XDG_STATE_HOME:-~/.local/state}/yash/history + + # handle old default history path + if [ -f ~/.yash_history ]; then + printf 'Note: The default history file location has been changed to "%s".\n' "$HISTFILE" >&2 + HISTFILE=~/.yash_history + printf 'Please consider moving the existing file from the current location "%s".\n' "$HISTFILE" >&2 + fi fi -# create HISTFILE directory if it doesn't exist -if [ ! -d "$(dirname "$HISTFILE")" ]; then - mkdir -p "$(dirname "$HISTFILE")" -fi +HISTSIZE=5000 # HISTRMDUP makes prediction less accurate # HISTRMDUP=500