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

Re: completion within word



"Matthias B." wrote:
> On Mon, 27 Sep 2004 15:18:49 +0100 Peter Stephenson <pws@xxxxxxx> wrote:
> 
> > "Matthias B." wrote:
> > > Pathname completion should *always* work *unconditionally* and
> > > everything else should be offered in addition to it, if the completion
> > > code believes it makes sense in the appropriate position.

Use _files as a completer. If you use a wrapper around _files, you can
make it return 1 causing later completers to get a go after it:

_files_first() {
  _files "$@"
  return 1
}
zstyle ':completion:*::::' completer _files_first _complete _ignored

It'll now always give you file completion. To solve the PATH colons
problems, add the compset commands in my later example.

> > You can bind a key that just does filename

> > Oliver may know some gotchas I'm missing.

Only that I'd use ':completion:complete-filename::::' as the context.

Also note that you can simply use:
  bindkey '\ef' _bash_complete-word

> I can tell you. It doesn't solve my original problem, which is that
> 
> BLA=/usr:/us<COMPLETE>

You can create a wrapper around _files to handle the colons:

_my_files() {
  compset -P '*:'
  compset -S ':*'
  _files "$@"
}

Oliver



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