zshzshrc

Bash setup making me not have history in zsh


I am trying out zsh, but it's pretty terrible so far, as I don't have history at all (well, 1 single line). What in my bash setup is causing this - assuming that some variables are shared? Alternatively, what do I have to do?

$ cd dotfiles;ag HIST
common-setup/bashrc
113:export HISTFILESIZE=
114:export HISTSIZE=
115:export HISTTIMEFORMAT="[%F %T] "
118:export HISTFILE=~/.bash_eternal_history
125:export HISTCONTROL=ignoredups

My entire zsh config, from my dotfiles:

# Keybindings, like the readline bindings
bindkey \^U backward-kill-line
bindkey \^K kill-line


# Zsh plugin manager (handles oh-my-zsh, etc)
# https://github.com/zplug/zplug
if [ -e ~/.zplug/init.zsh ]; then
    source ~/.zplug/init.zsh
fi

##################################################
## Based on zplug Example section
## https://github.com/zplug/zplug#example
##################################################

# Async for zsh, used by pure
zplug "mafredri/zsh-async", from:github, defer:0
# Load completion library for those sweet [tab] squares
#zplug "lib/completion", from:oh-my-zsh
zplug "plugin/z", from:oh-my-zsh

# Syntax highlighting for commands, load last
zplug "zsh-users/zsh-syntax-highlighting", from:github, defer:3
# Theme!
zplug "sindresorhus/pure", use:pure.zsh, from:github, as:theme

# Install plugins if there are plugins that have not been installed
if ! zplug check --verbose; then
    printf "Install? [y/N]: "
    if read -q; then
        echo; zplug install
    fi
fi

# Then, source plugins and add commands to $PATH
zplug load --verbose

edit: Could it be the shared history file? I have tried setting HISTFILE=~/.zsh-history in the start of .zshrc with no apparent effect.

Also tried adding:

export HISTFILE=~/.zsh_history
export HISTSIZE=100000 # can't be unset, like in bash

# Appends every command to the history file once it is executed
setopt inc_append_history
# Reloads the history whenever you use it
setopt share_history

Still, every time I execute zsh from a bash session, the history is empty.


Solution

  • The missing piece was SAVEHIST:

    export SAVEHIST=100000
    

    Found the hint here