1

Zsh, even with an empty zshrc file, appears to provide autocomplete options for every executable in my path. For example, typing ch<tab> gives me about 30 options, far too many to make autocompletion useful.

Can I set the paths that zsh looks up for completion options, so that I can narrow it down and get more useful suggestions?

3

Not really, given how e.g. Linux and especially e.g. Fedora now shove almost everything into /usr/bin. However! You can exclude or include things, depending on whether you have a known list of "only complete on these"

% zstyle ':completion:*:*:-command-:*' fake-always chmod chown
% zstyle ':completion:*:*:-command-:*' ignored-patterns 'ch*'
% ch
chmod  chown

or want to knock out a few specific annoying conflicting completions that you never use anyways

% exec zsh
% zstyle ':completion:*:*:-command-:*' ignored-patterns '(chat|chroot)'
% ...

though future you may end up scratching their head as to why some long since ignored command does not appear in the completion list (no this totally hasn't happened to me why do you ask)

% zstyle | grep command

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.