zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Yuri D'Elia <wavexx@thregr.org>
Cc: zsh-workers@zsh.org
Subject: Re: zle_highlight and yank
Date: Sat, 12 Dec 2015 08:55:40 +0000	[thread overview]
Message-ID: <20151212085540.GE1863@tarsus.local2> (raw)
In-Reply-To: <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..


      reply	other threads:[~2015-12-12  9:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-08 20:48 Yuri D'Elia
2015-12-08 21:28 ` Mikael Magnusson
2015-12-08 21:37   ` Yuri D'Elia
2015-12-12  8:55     ` Daniel Shahaf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151212085540.GE1863@tarsus.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=wavexx@thregr.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).