2013-01-11 65 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

謝謝你試試看。其實在其他一些情況下,即使我得到了理想的行爲。在我記得它正在發生的情況下,展品是符號鏈接。這有什麼區別嗎? –