zsh 选项卡补全不适用于运行 `zsh`

zsh 选项卡补全不适用于运行 `zsh`

一般来说,制表符补全在 zsh 中工作得很好,除非我尝试执行如下脚本:

zsh script.sh

在这种情况下,如果我写,zsh sc[TAB]我什么也得不到。是否有已知的修复方法或可能的原因解释?


$ zsh --version
zsh 5.8 (x86_64-apple-darwin21.0)

我现有的设置来自zshrc

# share history across multiple zsh sessions
setopt SHARE_HISTORY
# append to history
setopt APPEND_HISTORY
# adds commands as they are typed, not at shell exit
setopt INC_APPEND_HISTORY
# do not store duplications
setopt HIST_IGNORE_DUPS
# ignore duplicates when searching
setopt HIST_FIND_NO_DUPS
# removes blank lines from history
setopt HIST_REDUCE_BLANKS

# setup autocompletion
autoload -Uz compinit && compinit
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
# autocompletion using arrow keys (based on history)
bindkey '\e[A' history-search-backward
bindkey '\e[B' history-search-forward

setopt prompt_subst
autoload -U colors && colors
local resetColor="%{$reset_color%}"
PS1=""
PS1="%F{cyan}"'($(basename "$CONDA_DEFAULT_ENV")) '"$resetColor"
PS1+='%n%{$reset_color%}@$(scutil --get ComputerName):'"$resetColor"
PS1+=$'\e[38;5;211m$(short_cwd) ';
PS1+=$'\e[38;5;48m[$(git_repo):$(git_branch)] ';
PS1+='$resetColor$ ';

相关内容