Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: coloring substitution seems to eat next line.
- X-seq: zsh-users 28363
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: coloring substitution seems to eat next line.
- Date: Thu, 10 Nov 2022 13:42:20 -0800
- Archived-at: <https://zsh.org/users/28363>
- In-reply-to: <CAH+w=7ad8qjAKAH+36F0OHBCuEixM2ZirOoLu=GexE04KZ-ocQ@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <c87afbb9-d8d1-1d9f-09a3-0e4172fe080f@eastlink.ca> <CAN=4vMp6wFY5MG5dOgWRTqc3W1OvhKsU=bbWZyR=yZgNKt3rRw@mail.gmail.com> <549715c2-8b36-8b7e-e3ac-cac02f43dd0f@eastlink.ca> <CAN=4vMoDkfG=SgpLjreoWZhwrhfEucGgeiKoRXB+ZQgi=nHohA@mail.gmail.com> <CAH+w=7a5hsJ3N1T3iQJMnNLttB3wFrZVTqPtg5Sjh5TTY0Fi_A@mail.gmail.com> <0a7dbe0d-1554-269a-f420-bfe320c7c838@eastlink.ca> <CAH+w=7ad8qjAKAH+36F0OHBCuEixM2ZirOoLu=GexE04KZ-ocQ@mail.gmail.com>
On 2022-11-10 12:22, Bart Schaefer wrote:
Most of the time you want the parens when assigning all the elements
of an array at once. You should not use the parens for anything
that's meant to be a single string (or number).
Slowly I figure out what's really going on and don't have to rely on
rote copying of syntax.
local MATCH MBEGIN MEND
which should never appear except inside a function, and should only
appear at the beginning of the function and not inside a loop.
Heavy duty diagnostic stuff it seems.
$~foo (or ${~foo} means that the value of $foo should be interpreted
as a glob pattern rather than as a literal string.
Ah! When you type it in there verbatim it seems to always be the
pattern, but as a variable who's to say that the intention is? So some
way of making it explicit avoids semantic confusion. That's robust, I
like it. One more little thing:
string="${cc[$aa]/*(#i)$filter*/}"
if [[ "$string" ]]; then
cc[aa]=''
else
cc[$aa]=${cc[$aa]/(#b)($~zsh_case${filter})/$'\e['$color;1m${match[1]}$'\e[0m'}
... to delete non-matching lines, but I'll bet there's a better way than
this failed substitution.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author