2013-01-11 33 views
1

假设在命令行中I型:的zsh完成完整明确的茎,显示多个匹配

cd wi<TAB> 

,我有两个目录

windows/ wind-tunnel/ 

我没有得到任何回应。我希望

  1. 它来完成上升到“风声”
  2. 打印2建议完成

我不知道为什么弹不作任何这些默认行为。有了zsh丰富的完成系统,我无法搜索满足这些功能的行为。我曾经用tcsh的'增强'来获得这种行为,但是我不记得我认为zsh是前进方向的因素。

请有人指出我在正确的方向。

在此先感谢任何回复的人(尽管我会在结束问题之前亲自表示感谢)。这里是我的zsh配置(我不完全了解,但大多数线路是有原因的):

setopt bash_auto_list; 
setopt no_auto_menu; 
unsetopt ALWAYS_LAST_PROMPT; 

#^= control 
# \e or ^[ = meta/option/alt 

# _approximate - gives that beloved CSH complete=enhance in zsh 
# _complete - ensures we don't put a slash on the end of dirs when there are other longer matches 
# (otherwise we'd have to delete the slash and type the first letter of a longer completion) 
# http://grml.org/zsh/zsh-lovers.html 
#zstyle ':completion:*' completer _complete _approximate 

autoload -U compinit promptinit 
compinit -C 
promptinit 

## case-insensitive (all),partial-word and then substring completion 
#zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' 

# (Actually, I have more items in my matcher list, but I don't know how complicated you want your 
# matcher list to be.) Basically that means to prefer simple completion most, case insensitive 
# completion next, and finally to try replacing '-' with '_' and vice versa if no completion has 
# been found with the first two methods. If you'd like to know what else I have in my matcher list, 
# let me know. 
zstyle ':completion:*:complete:*' matcher-list '' '+m:{a-zA-Z}={A-Za-z}' '+m:{-_}={_-}' 

# tab completion for PID :D 
zstyle ':completion:*:*:kill:*' menu yes select 
zstyle ':completion:*:kill:*' force-list always 

################################## 

fpath=($fpath /usr/local/share/doc/task/scripts/zsh ~/.zsh-completion-functions) 
autoload -Uz compinit 
compinit 

# be verbose, i.e. show descriptions 
zstyle ':completion:*' verbose yes 
zstyle ':completion:*:descriptions' format '%U%B%d%b%u' 

# group by tag names 
zstyle ':completion:*' group-name '' 

############################## 
## Maven 
############################## 

#function listMavenCompletions { reply=(cli:execute cli:execute-phase archetype:generate compile clean install test test-compile deploy package cobertura:cobertura jetty:run -Dmaven.test.skip=true -DarchetypeCatalog=http://tapestry.formos.com/maven-snapshot-repository -Dtest= `if [ -d ./src ] ; then find ./src -type f | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`); } 
#compctl -K listMavenCompletions mvn 

#source ~/.zsh-tab-completions-mvn 
# COMPLETION SETTINGS 
# add custom completion scripts 
#fpath=(~/.zsh/completion $fpath) 
autoload -U compinit 
compinit 
zstyle ':completion:*' menu select=2 

回答

0

我似乎无法重现此。使用您~/.zshrc,我得到了以下行为:

charmander% ls 
wind-tunnel windows 
charmander% cd w<TAB> # Completes to `wind`: 
charmander% cd wind<TAB><TAB> # Requires two tabs to bring up menu, not sure why. 
local directory 
wind-tunnel/ windows/ 
charmander% cd wind 

有趣的是,我得到这个行为,当我不来源的任何启动文件:

charmander% zsh -f 
charmander% cd w<TAB> # Completes to `wind`: 
charmander% cd wind<TAB> 
wind-tunnel/ windows/ 

除非别人已设法与重现这个你~/.zshrc,也许增添了问题的一些详细信息,将是有益的,特别是任何在zsh启动文件信息:

  • /etc/zshenv
  • /etc/zprofile
  • /etc/zshrc
  • /etc/zlogin
  • ~/.zprofile
  • ~/.zshrc
  • ~/.zlogin
+0

谢谢你试试看。其实在其他一些情况下,即使我得到了理想的行为。在我记得它正在发生的情况下,展品是符号链接。这有什么区别吗? –