zsh-workers
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayned@users.sourceforge.net>
To: Zsh list <zsh-workers@zsh.org>
Subject: Re: How to get syntax highlighting working??
Date: Fri, 31 Dec 2010 10:28:59 -0800	[thread overview]
Message-ID: <AANLkTin8mo_VSXuaO1gijGJr0yDUoD0_AMFq4XoxM22w@mail.gmail.com> (raw)
In-Reply-To: <AANLkTi=T73W8vi3PJDH8=AWeCq-YG=iK_42MeBmU2Z-F@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1012 bytes --]

While playing with this syntax highlighting code, I've come to the
conclusion that it would be much nicer to have a hook where the zle code
asks for a changed line to be highlighted.  This avoids having to create
functions for an ever-changing plethora of zle functions, and makes things
like push-line, yank, yank-pop, delete-char-or-list, and who-knows-what-else
Just Work (all of which have issues when using override widgets).

Here's a patch for zsh:

  http://opencoder.net/zle-set-highlight-hook.patch

Thoughts?  I really like this single hook point for highlighting.

With that change, the init code for the zsh-syntax-highlighting code becomes
this simple line:

  zle -N zle-set-highlight _zsh_highlight-zle-buffer

Then, just to make the shell code a little more optimal, I added the
following to the top of _zsh_highlight-zle-buffer function (to avoid
identical highlight processing):

  [[ ${ZSH_PRIOR_HIGHLIGHTED_BUFFER:-} == $BUFFER ]] && return
  ZSH_PRIOR_HIGHLIGHTED_BUFFER=$BUFFER

..wayne..

       reply	other threads:[~2010-12-31 18:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <997733.11083.qm@web65612.mail.ac4.yahoo.com>
     [not found] ` <AANLkTi=T73W8vi3PJDH8=AWeCq-YG=iK_42MeBmU2Z-F@mail.gmail.com>
2010-12-31 18:28   ` Wayne Davison [this message]
2010-12-31 20:21     ` Bart Schaefer
2010-12-31 20:33       ` Mikael Magnusson

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=AANLkTin8mo_VSXuaO1gijGJr0yDUoD0_AMFq4XoxM22w@mail.gmail.com \
    --to=wayned@users.sourceforge.net \
    --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).