The easiest way to make a glob pattern match dot files is to use the D
glob qualifier.
**/*(D)
The precedence of ~
is lower than /
, so **~.hg/*
is **
minus the matches for .hg/*
. But **
is only special if it's before a /
, so here it matches the files in the current directory. To exclude .hg
and its contents, you need
**/*~.hg~.hg/*(D)
Note that zsh will still traverse the .hg
directory, which can take some time; this is a limitation of **
: you can't set an exclusion list directly at this level.
_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?
Best Answer
Thats three questions in one ;-)
AUTO_CD Option and howto find it
First of all the option you are looking for is AUTO_CD. You can easily find it by looking up
man zshoptions
. Use your pagers search function, usually you press / and enter the keyword. With n you jump to the next occurrence. This will bring up the following:The option can be unset using
unsetopt AUTO_CD
.Turning it properly off
You are using oh-my-zsh which is described as
So the next thing is to find out, how to enable/disable options according to the framework.
The readme.textile file states that the prefered way to enable/disable plugins would be an entry in your .zshrc:
plugins=(git osx ruby)
Find out which plugin uses the AUTO_CD option. As discovered from the manpage it can be invoked via the -J switch or AUTO_CD. Since oh-my-zsh is available on github, searching for it will turn up the filelib/theme-and-appearance.zsh
. If you don't want to disable the whole plugin "theme-and-appearance", put aunsetopt AUTO_CD
in your .zshrc. Don't modify the files of oh-my-zsh directly, because in case you are updating the framework, your changes will be lost.Why executables are not invoked directly
Your third question is howto execute a binary directly: You have to execute your binary file via a path, for example with a prefixed
./
as in./do-something
. This is some kind of a security feature and should not be changed. hing of plugging in an USB stick, mounting it and having a look on it withls
. If there is a executable calledls
which deletes your home directory, everything would be gone, since this would have overwritten the order of your $PATH.If you have commands you call repeatedly, setting up an alias in your .zshrc would be a common solution.