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

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

Thanks for your time, this is all a bit above me, and perhaps I should learn
more about zle and all to deserve the fancy and particular things I want...

> You can insert _expand_alias before _files in the list of completer
> functions. I'm not sure if that works in the way you want: a global
> alias will simply be expanded. If you tried that and it didn't work then
> I would suspect that your default completer style is getting precedence
> over this one. Try using more colons instead of a *:

Yes, it just expands the global alias, and then quits (?!). I would like it to
first expand, and then proceed with matching, or whatever it should do.

I have a couple of global aliases for directories:

  alias -g DL="~/dl/"

I tried out your most-recent-* and it seems fine and more robust. I can't get
it to work the way I want though. 

>   zstyle ':completion:most-recent-*::::' completer _menu _complete _match

If I add the _expand_alias like below, hitting ^Xm gives the expansion with a
trailing space. And nothing more happens. The hash is the cursor position:

  zstyle ':completion:most-recent-*::::' completer _expand_alias _menu _complete _match

  $ cat ~/dl/ #    

And if I add it after _menu, I get the expansion without a trailing space.
Hitting ^Xm again then sure enough gives me the newest file in "DL".

  zstyle ':completion:most-recent-*::::' completer _menu _expand_alias _complete _match

  $ cat ~/dl/#

Maybe the problem is related to alias expansion being inherently based on
words, and will typically expand with a trailing space. Is these directory
shortcuts I want a reasonable use of global aliases, or do I want something

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