zsh-users
 help / color / mirror / code / Atom feed
* Turn off completion of users
@ 2006-08-03 15:55 Ulrich Spoerlein
  2006-08-03 16:16 ` Peter Stephenson
  2006-08-03 16:42 ` Bart Schaefer
  0 siblings, 2 replies; 5+ messages in thread
From: Ulrich Spoerlein @ 2006-08-03 15:55 UTC (permalink / raw)
  To: zsh-users

Hi all,

I'm sorry if this is a FAQ, but all my googling was in vain. I also
found nothing appropriate in the zshall manpage.

Here's the problem:

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. Roughly like so:

% cd pro^D
local directory
profiles/
user
proxy

This is highly annoying behaviour, which I'd like to stop. I'm using the
default zshrc that get's shipped with zsh 4.3.2.

I think the Completion/Unix/_users might be responsible, is there a way
to selectively disable this completion scheme?

Bye,
Ulrich Spoerlein
-- 
A: Yes.
>Q: Are you sure?
> >A: Because it reverses the logical flow of conversation.
> >>Q: Why is top posting frowned upon?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Turn off completion of users
  2006-08-03 15:55 Turn off completion of users Ulrich Spoerlein
@ 2006-08-03 16:16 ` Peter Stephenson
  2006-08-03 17:06   ` Ulrich Spoerlein
  2006-08-03 16:42 ` Bart Schaefer
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2006-08-03 16:16 UTC (permalink / raw)
  To: zsh-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@csr.com>                  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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Turn off completion of users
  2006-08-03 15:55 Turn off completion of users Ulrich Spoerlein
  2006-08-03 16:16 ` Peter Stephenson
@ 2006-08-03 16:42 ` Bart Schaefer
  1 sibling, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2006-08-03 16:42 UTC (permalink / raw)
  To: zsh-users

On Aug 3,  8:55am, 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.
} 
} I think the Completion/Unix/_users might be responsible, is there a way
} to selectively disable this completion scheme?

It's not really _users, it's _cd -- you have setopt cdablevars, and the
_cd function therefore attempts to expand anything that can come after
a tilde, even if the tilde is not explicitly present.  I think the call
tree is _cd -> _tilde -> _users.

This came up at least once before, try searching the archives.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Turn off completion of users
  2006-08-03 16:16 ` Peter Stephenson
@ 2006-08-03 17:06   ` Ulrich Spoerlein
  2006-08-06  8:35     ` Vincent Lefevre
  0 siblings, 1 reply; 5+ messages in thread
From: Ulrich Spoerlein @ 2006-08-03 17:06 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-users, Bart Schaefer

Peter Stephenson wrote:
> 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".

Splendid!

Thanks to you and Bart for pointing me to the right direction.

Bye,
Ulrich Spoerlein
-- 
A: Yes.
>Q: Are you sure?
> >A: Because it reverses the logical flow of conversation.
> >>Q: Why is top posting frowned upon?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Turn off completion of users
  2006-08-03 17:06   ` Ulrich Spoerlein
@ 2006-08-06  8:35     ` Vincent Lefevre
  0 siblings, 0 replies; 5+ messages in thread
From: Vincent Lefevre @ 2006-08-06  8:35 UTC (permalink / raw)
  To: zsh-users

On 2006-08-03 19:06:56 +0200, Ulrich Spoerlein wrote:
> Peter Stephenson wrote:
> > 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".
> 
> Splendid!
> 
> Thanks to you and Bart for pointing me to the right direction.

Alternatively, if you still want cdablevars, but disable users and
named directories in the first completion choices, you can use that:

# Suggestion from
#   From: Peter Stephenson <pws@csr.com>
#   Date: Thu, 11 Mar 2004 12:28:17 +0000
#   Subject: Re: cd completion and CDABLE_VARS
#   To: zsh-users@sunsite.dk
#   Message-ID: <14646.1079008097@csr.com>
# to disable named directories in the first completion choices.
zstyle ':completion:*:complete:(cd|pushd):*' tag-order \
  'local-directories path-directories directory-stack' '*'

Works very well for me.

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-08-06  8:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-03 15:55 Turn off completion of users Ulrich Spoerlein
2006-08-03 16:16 ` Peter Stephenson
2006-08-03 17:06   ` Ulrich Spoerlein
2006-08-06  8:35     ` Vincent Lefevre
2006-08-03 16:42 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).