通常,zsh
的制表符补全效果很好。
$ touch foo-1-bar foo-2-bar
$ touch f<Tab>
$ touch foo--bar
^ cursor here
Run Code Online (Sandbox Code Playgroud)
再次按下Tab会弹出一个菜单,我可以从中选择文件。
$ touch foo--bar
foo-1-bar foo-2-bar
Run Code Online (Sandbox Code Playgroud)
但是,这似乎不适用于开头和结尾匹配的字符串。例如:
touch foo-bar foo-foo-bar
touch f<Tab>
touch foo-bar
^ cursor here. <tab> again.
touch foo-bar
^ cursor here.
Run Code Online (Sandbox Code Playgroud)
没有显示任何菜单,也没有机会选择foo-foo-bar
。这是预期的行为还是错误?是否有设置可以使菜单出现在后一种情况下?
我在用着oh-my-zsh
。我尝试从 中删除所有与完成相关的行~/.zshrc
,但这没有什么区别。
根据评论,我尝试禁用oh-my-zsh
,这解决了这个问题。然后我浏览了oh-my-zsh
源代码,有选择地禁用模块。
我以前有过CASE_SENSITIVE="true"
,但是注释掉这一行为我解决了这个问题。显然这是一个已知的错误。
~/.zshrc
为了解决这个问题,我可以在 source 之后添加以下行oh-my-zsh
。
zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*'
Run Code Online (Sandbox Code Playgroud)