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

Re: [zsh 4.0.1 bug] filename completion



Vincent Lefevre wrote:

> On Tue, Jun 26, 2001 at 15:29:30 +0200, Sven Wischnowsky wrote:
> > In terms of sh/ksh/bash-compatibility, yes.  But for zsh it will give
> > you the same unless you have shwordsplit set.
> 
> It is currently unset, but I don't want to break my current functions
> if I change my mind in the future...
> 
> I've just tried your solution and it doesn't work.
> 
> greux:~> which c.                                                     <15:32:45
> c. () {
>         setopt localoptions nocdablevars
>         local CDPATH
>         cd "$@"
> }
> 
> and I have
> 
> compdef c.=cd
> zstyle ':completion:*:*:c.:*' tag-order local-directories
> 
> at the end of my .zshrc, but when I type "c. soft" and try to complete,
> nothing happens.

Ouch, right.  I hadn't realised that it tries to complete parameters
even if only local-directories are selected.

As a quick fix, you can add a small completion function for `c.', like this:

  c. () {
        setopt localoptions nocdablevars
        local CDPATH

        cd "$@"
  }
  _c.() {
        setopt localoptions nocdablevars
        local CDPATH

        _cd "$@"
  }
  compdef _c. c.
  zstyle ':completion:*:*:c.:*' tag-order local-directories

Note that the compdef line changed.


Whoever wrote that code in _cd should probably start re-thinking it (and
I don't think it was me this time).


Bye
  Sven


-- 
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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