如何使zsh compsys回退到本地文件以执行命令?

如何使zsh compsys回退到本地文件以执行命令?,zsh,completion,Zsh,Completion,我认为最简单的例子是,如果命令不存在,那么无效命令将显示一个文件列表,您可以在该列表上单击“完成” 如果命令(和完成)确实存在,则在耗尽完成时,点击将产生铃声,例如: prompt > yarn test <TAB> 为了产生上述行为,我目前有以下几点: zstyle ':completion:*' completer _complete _correct _approximate _files zstyle ':completion:*:descriptions' form

我认为最简单的例子是,如果命令不存在,那么
无效命令
将显示一个文件列表,您可以在该列表上单击“完成”

如果命令(和完成)确实存在,则在耗尽完成时,点击
将产生铃声,例如:

prompt > yarn test <TAB>
为了产生上述行为,我目前有以下几点:

zstyle ':completion:*' completer _complete _correct _approximate _files
zstyle ':completion:*:descriptions' format "- %d -"
zstyle ':completion:*:corrections' format "- %d - (errors %e})"
zstyle ':completion:*:default' list-prompt '%S%M matches%s'
zstyle ':completion:*' group-name ''
zstyle ':completion:*:manuals' separate-sections true
zstyle ':completion:*:manuals.(^1*)' insert-sections true
zstyle ':completion:*' menu select
zstyle ':completion:*' verbose yes
zstyle ':completion:*' rehash yes
zstyle -e ':completion:*:approximate:*' max-errors \
          'reply=( $(( ($#PREFIX + $#SUFFIX) / 3 )) )'
我曾希望在
:completion:
的末尾添加_文件:如果没有其他完成,它将返回到当前文件,但我似乎对此假设很幼稚:)

我想我可以深入到_命令完成定义中,并将其单独添加到每个定义中,但是作为一个常规的回退,这似乎非常合适(并且与以前的经验相匹配)

zstyle ':completion:*' completer _complete _correct _approximate _files
zstyle ':completion:*:descriptions' format "- %d -"
zstyle ':completion:*:corrections' format "- %d - (errors %e})"
zstyle ':completion:*:default' list-prompt '%S%M matches%s'
zstyle ':completion:*' group-name ''
zstyle ':completion:*:manuals' separate-sections true
zstyle ':completion:*:manuals.(^1*)' insert-sections true
zstyle ':completion:*' menu select
zstyle ':completion:*' verbose yes
zstyle ':completion:*' rehash yes
zstyle -e ':completion:*:approximate:*' max-errors \
          'reply=( $(( ($#PREFIX + $#SUFFIX) / 3 )) )'