Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to get syntax highlighting working??
- X-seq: zsh-workers 28561
- From: Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx>
- To: Zsh list <zsh-workers@xxxxxxx>
- Subject: Re: How to get syntax highlighting working??
- Date: Fri, 31 Dec 2010 10:28:59 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=tItErPguJKqFya9sTyux+zNwi44E6HOMYSqq7iTx80g=; b=RxEF6Qgco/Th0ppf+8EzzUCgOdCaGJRVKenQgMuoToeE2f+JeF4kAVQwUCynnuA7J4 cTLQaxvO50PFSdhCkwGiDQpWONwmbWmSJqRj6PsOAoQ1fFmT1qTqT28CLyftGweGBHR5 2foNbUX3r+nb2i31j5zE1baGIuGy5XjMk4CBQ=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=KEeMf0FJPsIynkAcoQCdjCfsvt0Vp0kxHgRbUHlCUJyttuoG8dGtuf0cPhyO3wm+2i ngwQ+HLIJeAVslQ3OBqAiSJztgDy9M5jqWXcU4Z0NJPPQZ/aqeb48h5pW+ythHgTJsYF AvuLL5QjMbH03ro8dn7Td4mVIYuKaD93h4zIY=
- In-reply-to: <AANLkTi=T73W8vi3PJDH8=AWeCq-YG=iK_42MeBmU2Z-F@xxxxxxxxxxxxxx>
- 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: <997733.11083.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxx> <AANLkTi=T73W8vi3PJDH8=AWeCq-YG=iK_42MeBmU2Z-F@xxxxxxxxxxxxxx>
- Sender: 4wayned@xxxxxxxxx
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..
Messages sorted by:
Reverse Date,
Date,
Thread,
Author