如何在 zsh 中显示比默认 16 个更多的条目?

如何在 zsh 中显示比默认 16 个更多的条目?

这是我的 ~/.zsh/.zshrc -

/home/shirish/.zsh> cat .zshrc
# Lines configured by zsh-newuser-install
HISTFILE=~/.zsh//.histfile
HISTSIZE=10000
SAVEHIST=100000
setopt inc_append_history autocd nomatch notify share_history
bindkey -e
# End of lines configured by zsh-newuser-install

# display how long all tasks over 10 seconds take
export REPORTTIME=10

# The following lines were added by compinstall
zstyle :compinstall filename '/home/shirish/.zsh//.zshrc'

autoload -Uz compinit promptinit
compinit
promptinit
# End of lines added by compinstall

#from https://unix.stackexchange.com/questions/332732/removing-strange-characters-from-a-zsh-prompt

export LC_ALL=en_IN.UTF-8
export LANG=en_IN.UTF-8
export LANGUAGE=en_IN.UTF-8

#from https://unix.stackexchange.com/questions/332888/how-to-have-a-longer-xterm-title-in-zsh

autoload -Uz add-zsh-hook

function xterm_title_precmd () {
    print -Pn '\e]2;%n@%m %1~\a'
}

function xterm_title_preexec () {
    print -Pn '\e]2;%n@%m %~ %# '
    print -n "${(q)1}\a"
}

if [[ "$TERM" == (screen*|xterm*|rxvt*) ]]; then
    add-zsh-hook -Uz precmd xterm_title_precmd
    add-zsh-hook -Uz preexec xterm_title_preexec
fi


prompt bigfade

现在,如果我尝试获取历史记录输出,我只能从 .zsh 中获取历史记录中的 16 个条目。如果我想查看所有条目怎么办?由于某种原因,它只保存/显示 16 个,其余的似乎没有被记录,我确实有同一个 shell 的多个选项卡。我不知道这是一个错误还是我需要添加更多内容。

答案1

man fc

如果first和last都被省略,则应列出前16条命令或编辑前一条命令(基于-l选项)。

为了解决您的问题:alias history='fc -l -100'

相关内容