我在下面
.zshrc
export HISTFILE="$HOME/.zsh_history"
export SAVEHIST=10000
export HISTSIZE=$SAVEHIST
setopt HIST_IGNORE_DUPS
setopt HIST_SAVE_NO_DUPS
setopt HIST_NO_STORE
setopt HIST_IGNORE_SPACE
后来,我意识到我在
tmux
会话中使用的命令在tmux
之外的会话中不可用。我假设它们不在 $HOME/.zsh_history
文件中。
所以搜索互联网做了这些改变:
在我.tmux.conf
set -g history-limit 10000
set -g history-file ~/.zsh_history
& 在我的
.zshrc
文件中设置额外的历史记录选项
setopt append_history
setopt hist_expire_dups_first
setopt hist_find_no_dups
setopt hist_ignore_all_dups
setopt inc_append_history
重启后,我在
~/.zsh_history
中的所有命令历史记录都被我今天输入的命令所取代,所有旧命令都没有了。我有大约 3000 多个命令。
我有几个问题
tmux
保存了命令历史记录,而无需我在 history-file
文件中明确设置 .tmux.conf
选项,我现在可以访问该文件吗?希望我能知道如何恢复。~/.zsh_history
。感谢您的宝贵时间。非常感谢您的帮助。
-- 苏迪尔