On Sun, Sep 18, 2022 at 2:43 AM Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
>
> On Sun, 18 Sept 2022 at 01:27, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>>
>> Where would this fit in the overall design of contexts?
>
> I'm not sure, however there's a solution on the web, see: https://stackoverflow.com/a/59513051/11999858
That solution gives the user control over when global aliases are
completed, by adding a function that can be placed anywhere in the
completer zstyle. The suggested value of that zstyle happens to make
global aliases complete before anything else, but that doesn't answer
the question of how a default should work.
Maybe looking from named dirs perspective can help? Currently, cd ~HO<tab> doesn't complete, too. I think that lack of such an obvious feature can make forward a way of completing also global aliases (like alias -g HOME ~)? How should be ~HOME completed I think that everybody knows (with exception of me)? The global aliases should be completed the same.
>> Do the aliases expand or is just their name completed?
>
> I think that only its name should be completed.
I'll note that theoretically the ^Xa key binding (expand aliases) can
be programmed to complete when a partial word matches an alias and
expand when a full word matches. I didn't attempt setting up the
necessary zstyle contexts.
When I tried ^Xa on my incomplete global alias it didn't complete…
> I think that it shouldn't be expanded, so the issue isn't actual.
Upon further thought, I agree that it's not an issue for completion of
an alias itself. More generally, though, if the expansion of a global
alias contains ";" or "|" or "&&" or "||" etc., then ideally further
completions shouldn't be using the context of the preceding command
word. Unfortunately that requires checking every word to the left of
the cursor for a global alias, and expanding it, to get the "real"
context.