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

Re: Turn off completion of users



Ulrich Spoerlein wrote:
> There is a user 'proxy' on my system, when I now try to 'cd' into a
> directory, let's call it 'profiles' the file/dir completion will offer
> me 'proxy' as an alternative.

This is because of the option "cdablevars".  This makes it possible for
"cd user" to behave the same as "cd ~user"; it works for user
directories and named directories (i.e. where ~var behaves like $var)
alike, since those deliberately have the same behaviour.  If you're not
using that, you can "unsetopt cdablevars".

If you want to keep the option but disable completion of relevant
directories, you will need to tweak the code:  find the _cd completer in
your $fpath,

print $^fpath/_cd(N)

and edit it or copy and edited version earlier in the $fpath.  The bit
you want to get rid of is around line 47, the line beginning alt=:

    if [[ -o cdablevars && -n "$PREFIX" && "$PREFIX" != <-> ]]; then
      if [[ "$PREFIX" != */* ]]; then
        alt=( "$alt[@]" 'named-directories: : _tilde' )
      else

Simply commenting out that single line should probably be enough.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php



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