Bash设置使我在zsh中没有历史记录

时间:2019-04-04 09:17:42

标签: zsh zshrc

我正在尝试zsh,但到目前为止还很糟糕,因为我根本没有历史记录(嗯,只有1行)。我的bash设置中是什么导致这种情况-假设某些变量是共享的?另外,我该怎么办?

$ 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

我的dotfiles中的整个zsh配置:

# 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:可以是共享历史记录文件吗?我尝试在HISTFILE=~/.zsh-history的开头设置.zshrc,但没有明显效果。

还尝试添加:

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

不过,每次我在bash会话中执行zsh时,历史记录都是空的。

1 个答案:

答案 0 :(得分:0)

缺少的部分是SAVEHIST

export SAVEHIST=100000

找到了提示here