3
我想要讓我可以完成標籤調整的zsh:如何刪除zsh完成中的文件擴展名?
myprog <tab>
使用~/somedir
所有*.foo
文件,但它的話,它顯示他們沒有的.foo
擴展。
有沒有辦法做到這一點?
這是我到目前爲止有:
#compdef myprog
typeset -A opt_args
local context state line
local -a mydirs
mydirs="(. ~/somedir)"
_arguments -s -S \
"*:name:->foos" \
&& return 0
case $state in
(foos)
_files -W ${mydirs} -g '*.foo(:r)' && return 0
;;
esac
return 1
然而,這顯示了一倍,每個文件的輸出(即每個.foo
文件列有和沒有它的擴展名)。有沒有辦法解決?
你介意這個答案有點延伸嗎?我不完全熟悉zsh的完成語法,並且無法推斷從哪裏開始。 – Michael 2010-03-23 19:34:41
Nvm,明白了:'zstyle':完成:*'文件模式'%p:globbed-files:''屬於我的.zshrc。謝謝! – Michael 2010-03-23 19:44:10