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

Re: Problem with fake-files style and cd



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.

-- 



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