Patrick Collins
Patrick Collins

Reputation: 10594

Turn off zsh completion of users everywhere

I work on a system with about 60k users. I use zsh with oh-my-zsh. Autocompletion is mostly great, but periodically it tries to autocomplete with the name of a user on the system. This hangs my shell for 2-3 seconds. It often tries to complete with a username, even if it's expecting something like a path. It happens frequently in a variety of different commands.

It's very frustrating.

I've tried to turn it off with:

zstyle ':completion:*:*:*:user' ignored-patterns '*'

but it didn't work (I tried testing it with su TAB and it hung for the normal 2-3 seconds).

I want to stop zsh from ever trying to autocomplete with a username anywhere. All of the solutions I see online involve turning it off on a command-by-command basis, which I'd rather not bother with, because there will never be a situation where I want zsh to complete with a user.

Can this be done?

Upvotes: 1

Views: 723

Answers (1)

Patrick Collins
Patrick Collins

Reputation: 10594

The following seems to work in most cases:

zstyle ':completion:*' users

(i.e. provide the empty list as the list of users to draw from) although I've seen usernames pop up once or twice since then.

Upvotes: 1

Related Questions