_kadmin
is probably a completer function for the kadmin
tool - not a directory. If you attempt completion on something that zsh
can't find as a command, a directory or a valid and known command argument completion, it then starts to offer completion functions as possible expansion candidates. By default, zsh
comes with a lot of completers, many of which you may not need - there are bundles for AIX, BSD, Cygwin, various Linux distributions, etc, and they all get read and installed into the shell. If you attempt an expansion on something zsh
can't find, it has all those installed completion functions to offer you instead.
You configure zsh
not to offer completer functions by putting this in your ~/.zshrc
:
zstyle ':completion:*:functions' ignored-patterns '_*'
Reload the file and you should no longer be offered completion functions for tools you don't have installed. Have a look at the zshcompsys
manpage for (a lot) more detail.
EDIT in reply to UPDATE 3
If _kadmin
is actually a user account, you can configure zsh
to not offer it in completions. It seems the approach is to list the user accounts you do want the shell to consider, which limits any names offered only to those listed. The zstyle
line is something like this:
zstyle ':completion:*' users asgeo1 root
I think you can list as many users as you like after the users
tag. The shell will then only offer those users' home directories as possible completions for the cd
function or builtin.
I don't know why adding the username to the ignored-patterns in the completion.zsh
file didn't work - did you reload your config after making the change?
Add this to your .zshrc
and ..[TAB] will complete to ../ as per bash
.
zstyle ':completion:*' special-dirs true
Best Answer
You had the options
auto_cd
andcdable_vars
turned on. Withauto_cd
, if you type a directory as a command name, thecd
command is implied. Withcdable_vars
, if a directory doesn't exist, or a command doesn't exist withauto_cd
, then the name is looked up in the directory hash table.As long as you're using the “new-style” (
compinit
) completion system, which oh-my-zsh turns on, the name will be offered as a completion when relevant.