Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zle_highlight and yank
- X-seq: zsh-workers 37394
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Yuri D'Elia <wavexx@xxxxxxxxxx>
- Subject: Re: zle_highlight and yank
- Date: Sat, 12 Dec 2015 08:55:40 +0000
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=RSOPxjoQzHxICbsThX39LvDmDls=; b=QoWCFh 4wfUtV5ksgR58VE6A1lOkURJMtdiZ6aryZj1RxlIHzuzkaWxUchDkN2iBtMYYg8T rPqL/x+1VaJtfGiy6xDxQA5Tv5VFarZmbcgsCqnFUkgcyCFSh4hBjjdtsqtwwPmf 9PJSWF4UlXLVsl4DNMTiThYr7AY5gbR0StXhs=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=RSOPxjoQzHxICbsThX39LvDmDls=; b=cgAyn fIG/SEIUGsijBtkpyUd/KUzsLlcWMwQ6iol6bydzsJm4dwreCmypWYz94nZAMpID 5zp4FVPi2N/FCXKA1AORKwIX+jTxYUM/NlxNhchQlWJmyz2d+qoIvaI5VHZo2pGP ZZVEgDsWHr+w9RNwmXcVy5hu3TRjPUjSvenqEg=
- In-reply-to: <n47ij1$g68$1@ger.gmane.org>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <n47fmi$2v1$1@ger.gmane.org> <CAHYJk3SAyzVHV79iJHtS4926A7sSn5MZHFbXA+ErwKJwdLtprA@mail.gmail.com> <n47ij1$g68$1@ger.gmane.org>
Yuri D'Elia wrote on Tue, Dec 08, 2015 at 22:37:36 +0100:
> On 08/12/15 22:28, Mikael Magnusson wrote:
> >> I would have expected it to respect the paste: style.
> >>
> >> Or maybe it's a good idea that it doesn't, to differentiate between a
> >> terminal paste and a regular one. But then again, I'd like a yank: style
> >> in there.
> >
> > I guess it's a bug that (none) doesn't disable the paste: style, but
> > you can explicitly put in paste: to disable it if you want, eg
> > zle_highlight=(none paste:)
>
> I really only wanted to disable yank highlighting, which I find
> distracting since I often know exactly what I just previously cut.
>
> But I do find highlighting for paste generally useful on the other hand.
Try this:
f() {
zle .$WIDGET "$@"
integer start end
if (( YANK_START > YANK_END )); then
start=$YANK_END end=$YANK_START
else
end=$YANK_END start=$YANK_START
fi
region_highlight+=("$start $end bg=blue")
zle -f 'yank'
}
zle -N yank f
You will want to change 'bg=blue' to whatever your default colors are;
for some reason specifying "none" doesn't override the 'standout'
highlighting.
"zle -f" was added in zsh-5.2, for older versions just comment it out.
Cheers,
Daniel
P.S. It'd be nice to have built-in min() and max() math functions..
Messages sorted by:
Reverse Date,
Date,
Thread,
Author