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

Re: suffix alias on a generated file name



zzapper wrote on Tue, 17 Dec 2019 10:02 +00:00:
> Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote in
> news:20191216035801.doeloio2cwauxguj@tarpaulin.shahaf.local2: 
> 
> > zzapper wrote on Sun, Dec 15, 2019 at 16:20:16 -0000:
> >> Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote in
> >> news:20191214111751.ot4jd3o5esekqyfb@tarpaulin.shahaf.local2: 
> >> 
> >> 
> >> >> BUT how do I do that without the manual TABing?
> >> > 
> 
> > I suppose you could wrap the accept-line widget to perform expansion:
> > 
> >     accept-line() { zle expand-word; zle .accept-line -- "$@" 
> >     zle -N accept-line
> > 
> > (untested)
> > 
> Daniel nothing seems to work I think there must be something 'funny' about 
> the way a suffix alias works i.e it must be the first thing that the shell 
> sees.

Aliases _are_ parsed very early (see zshexpn(1) near the top), but zle
widgets run even earlier than that, before the command-line is parsed at
all.

What the example code does is change the meaning of pressing
<Enter> so it's like pressing <Tab><Enter>. That's what you wanted to
do, isn't it?



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