Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Moving completion functions
- X-seq: zsh-workers 13717
- From: Oliver Kiddle <opk@xxxxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxxxxx>
- Subject: Re: Moving completion functions
- Date: Thu, 22 Mar 2001 21:50:29 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <3ABA72A9.EB9C68FC@xxxxxxxxxxxxx>
- Sender: opk
I wrote:
> The other thing which might be worth doing is looking through any other
> functions any of us have. From these we may find some suitable for the
> I've attached two of mine: hgrep is like grep but highlights
Of course, it would help if I actually remembered to attach them.
They should be on this e-mail.
Oliver
# hgrep - highlight grep
if (( ! $# )); then
echo "Usage: $0:t [-e pattern...] [file...]" >&2
return 1
fi
local -a regex
local htext=`echotc so` ntext=`echotc se`
while [[ "$1" = -e ]]; do
regex=( $regex "$2" )
shift 2
done
if (( ! $#regex )); then
regex=( "$1" )
shift
fi
regex=( "-e
s/${^regex[@]}/$htext&$ntext/g" )
sed ${(Ff)regex[@]} "$@"
local arg s
(( $# == 1 )) || s=s
echo received $# argument$s
for arg; do
echo -E - ">>$arg<<"
done
Messages sorted by:
Reverse Date,
Date,
Thread,
Author