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

Re: How to get faster completion if I make zsh assume what I've typed so far is correct?



paxunix wrote:

[ using zstyle ':completion:*:paths' accept-exact '*' to avoid partial completion globs on directory elements ]

There are a couple of very annoying issues with this solution: ambiguous matches are not cycled through correctly and it is impossible to complete some pathnames. For example, if you have two directories:

dir1
dir1~

Typing dir<TAB> will complete up to 'dir1' and (in my case) show dir1 and dir1~ as possible completions. Successively hitting TAB will never cycle through to dir1~ - a trailing '/' is inserted after dir1 and zsh lists the contents of dir1 as possible completions. It appears that any common prefix to an initial path completion attempt causes completion to continue inside the first directory match. If it's between a directory and a filename with a common prefix, things work as they are supposed to.

On a hunch, I changed the '*' to '*(N)', so my resulting zstyle line became:

zstyle ':completion:*:paths' accept-exact '*(N)'

and so far this seems to do precisely what I want, without the above annoyances. I especially noticed the difference when completing dotfiles in my home directory. Without '*(N)', try:

ls ~/.<TAB>

and notice that none of the dotfiles are given as possible completions. Instead you get a trailing slash appended and then non-dotfile completions from the home directory. With '*(N)', this works as expected.

--
Shawn Halpenny



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