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

Re: [PATCH] Don't complete escaped words as aliases



On Sat, Nov 13, 2021 at 9:02 AM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>
> On 11/12/21, Marlon Richert <marlon.richert@xxxxxxxxx> wrote:
> > It doesn't make sense to complete \escaped 'words' as aliases, since
> > they won't be expanded as aliases either.
>
> Would this break aliases of this form?
>
> % alias 'foo\bar'=echo\ hi
> % foo\bar
> hi

I think "break" is a bit of an overstatement. These aliases will still
be expanded once the command line has been accepted. They just won't
be completed.

If we require that aliases of that form are still completed, an
alternative could be to do `local +h PREFIX=$words[CURRENT] SUFFIX=`
before calling alias completion. The drawback to that approach is that
it effectively negates COMPLETE_IN_WORD. Getting unquoted versions of
$PREFIX and $SUFFIX, however, doesn't appear to be possible within a
completion function.

Would this be preferable? I can make that change. No other
alternatives come to mind right now.




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