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

Re: Path to fix copy-earlier-word handling of numeric arguments



On Thu, Apr 4, 2024 at 12:03 PM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>
> On Thu, Apr 4, 2024 at 11:41 AM Huy Z <h-zsh@xxxxxxx> wrote:
> >
> > As initially submitted at https://github.com/zsh-users/zsh/pull/116 :
> >
> > ________________________________
> >
> > As mentioned in the code comment:
> >
> >   # 1 means last word, 2 second last, etc.
> >
> > the numeric argument is supposed to be interpreted as an offset from the end.
> >
> > The intended behavior is a lot more useful than the current behavior.
>
> NAK on this, this is not only longstanding behavior, but also what is
> actually documented in the manpage:
>   words on the relevant history line.  With a numeric argument  N,  insert  the
>   Nth  word  from  the history line; N may be negative to count from the end of
>   the line.

If you feel the other way around is more useful, perhaps adding a
zstyle to configure it would be a good idea, eg
if zstyle -t :$WIDGET count-from-end; then ...; else ...; fi

-- 
Mikael Magnusson




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