Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: coloring a substitution
- X-seq: zsh-users 28346
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: coloring a substitution
- Date: Tue, 8 Nov 2022 15:49:43 -0800
- Archived-at: <https://zsh.org/users/28346>
- In-reply-to: <CAN=4vMqMsigw20xAdLGcTNmTVKWe4chtFRWLdcXdXS4zQR_Q2w@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <5454df12-02c6-75b5-e552-c486e231183c@eastlink.ca> <CAN=4vMqMsigw20xAdLGcTNmTVKWe4chtFRWLdcXdXS4zQR_Q2w@mail.gmail.com>
On 2022-11-08 13:10, Roman Perepelitsa wrote:
- `print` is equivalent to `print -r --` here
Right! It's one of those things that's easy to overlook until some
weird name bites you.
recent[$aa]=${recent[$aa]//(#i)$filter/$'\e['$color';1m'$filter$'\e[0m'}
Therewego, > $'\e[' < replaces > \x1b\[ <.
Thanks Roman.
BTW as it stands now my filtering issue on the other thread:
For globbing for files on the disk: ($zsh_case = '(#i)'):
[ "$wild_msg" = 'WILD' ] \
&& eval "wholedisk=( $zsh_case/**/*$1*(/N) )" \
|| eval "wholedisk=( $zsh_case/**/$1(/N) )"
For string searches in the directory stack:
for (( aa = 1; aa <= $#cc; aa++ )); do
# These are full names, $1 may be only a partial match if we are WILD.
dirname=${cc[$aa]:t}
if [[ "$scope_msg" = 'BROAD' && $dirname = (#i)*$1* ]] \
|| [[ "$scope_msg" = 'Case INsensitive TAME' && $dirname:u = $1:u ]] \
|| [[ "$scope_msg" = 'Case Sensitive WILD' && $dirname =~ $1 ]] \
|| [[ "$scope_msg" = 'EXACT' && $dirname = $1 ]]; then
; # Do nothing, we have a match.
else cc[$aa]= # Kill the line, it does not match.
fi
done
... any further improvements?
Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author