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

Re: Problem with fake-files style and cd



2009/2/15 Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>:
> On Feb 14, 11:09pm, Mikael Magnusson wrote:
> }
> } > zstyle -e :completion::complete:cd::path-directories ignored-patterns \
> } >        'reply=( *(/) )'
> } >
> } > This says that when completing in the cdpath, ignore any name that matches
> } > the name of a directory in the current directory.
> }
> } while the above appears to work, it really doesn't:
> } % mkdir path/code/foo
> } % cd code/<tab>
> } ---- local directory
> } foo/
> } ---- directory in cdpath
> } bar/  foo/
> }
> } Presumably this is because *(/) (which I changed to *(-/) (not in the
> } above testcase though)) only matches one segment and that *(/) is run
> } in $PWD, not $PWD/$PREFIX?
>
> Yep, true.  Try it this way:
>
> zstyle -e :completion::complete:cd::path-directories ignored-patterns \
>        'reply=( ${PREFIX}*(-/) )'
>
> You might need to fool around with that a bit; for example, if you don't
> use the _expand completer you may want ${~PREFIX}*(-/) instead.  There
> may also be tricky bits with IPREFIX, QIPREFIX, and special cases for
> completing in the middle of a word instead of at the end.

Aha, I didn't expect my wild guess to even have the correct variable
name :). If it breaks though, the worst that could happen is that I
get a duplicate entry in the listing though?

Thanks! I'll try this for a while and see what happens.

-- 
Mikael Magnusson



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