I use compctl -K _my_cpl ls to bind my automatic function to the ls . The function returns a list of names from the index file.
However, zsh always adds a space after each completion. If I want to automatically fill in several level directories, I have to remove the space every time. Is there a way to remove extra space, like the -o nospace option in bash full command?
I tested the zstyle ':completion:*' add-space false command and it does not work. Thanks.
_my_cpl() { local cur last opts # current word in command line. read -cA cur last=$cur[-1] # grep all directories and file names under current directory level. opts=`egrep "${last}[^/]*[$|/]*" ~/index -o |uniq` reply=($=opts) } compctl -K _my_cpl ls
source share