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

Re: command completion



On Aug 15,  2:57am, Vincent Lefevre wrote:
}
} > [...] because there are two passes and there are no
} > *additional* completions for the "command" tag added inside _cd, all
} > the defaults for _cd get added as well.
} 
} OK, but this behavior is a bit strange: if I use
} 
}   zstyle ':completion:*:complete:-command-:*' tag-order 'commands'
} 
} on my example, then I get:
}   % prefix-
}   prefix-cmd1  prefix-dir/
} from the "dir" directory. And from the parent directory "temp_dir",
} prefix[TAB] gives prefix-cmd1 only (i.e. prefix-dir/ has mysteriously
} disappeared though it is a cd target).

To understand that you have to read comments in _cd, explaining that
it assumes (incorrectly because of your tag-order) that _command_names
has already added all the names of local subdirectories, so _cd should
not do so again.

Wheels within wheels ...
 
} However wouldn't it be cleaner if there were a specific
} tag for autocd?

Yes, but to do that would require abstracting the guts of both _cd
and _command_names somehow so they could be combined into a single
_tags loop in _autocd.  As you're the only person who has complained
about this in many years, there's been no impetus to make that effort.

Most people are probably already have

zstyle ':completion:*:complete:*' group-name ''

and are therefore content with

zstyle ':completion:*:complete:-command-:*' group-order commands

which makes sure that the command names are offered first, rather
than mixed with the directory names.



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