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

Re: completer that first expands global aliases (Re: dsf)

On Jan 9,  7:29am, Daniel wrote:
} But what was your _expand_alias_hack returning non-0 and attempt with
} compprefunc() supposed to do then? I though they would manage to have
} the alias expanded and then continue with completion. But as I said,
} they stop short of actually completing. But the expansion is done, and
} does NOT leave any trailing space/word boundary...

_expand_alias is a completion function, so it is changing the result of
completion, not the input to completion.  This means that the next step
(_menu or _complete, for example) still see the original input "DL" and
find no completions for it.

All that my hacks accomplish is to tell the shell that the expansion
step is not in itself a successful completion, so that it won't append
the the auto-suffix and leaves you able to continue completing with the
expansion in place.  I thought beforehand that the the compprefuncs one
might do a bit more, but it doesn't.

To accomplish what you want, you need to expand the alias before the
completion is invoked.  You can't do this within a single "zle -C"
widget without mucking around the values of words[CURRENT] and PREFIX,
and it may not always work even then.

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