Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Issue with directory word completion



On Apr 21,  6:22am, Felipe Contreras wrote:
}
} compadd -f -- 'Documents' 'Downloads/'

You're not supposed to include a trailing slash on the compadd string.
The completion system will figure that out on its own and append the
slash if appropriate.  Note from the docs for -f:

          ... all of the matches built from WORDS are
          marked as being the names of files.  They are not required to
          be actual filenames ...

"Downloads/" is not an "actual filename" so it's marked as a file.  The
"actual filename" of the directory is "Downloads".

I can already hear your objection, but what you're running into here is
a division-of-labor decision:  the calling shell code is capable of doing
the slash removal, and therefore it is left to it to do so rather than
complicate the already fairly incomprehensible internals even further.



Messages sorted by: Reverse Date, Date, Thread, Author