From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15783 invoked by alias); 31 Dec 2010 18:29:08 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28561 Received: (qmail 4923 invoked from network); 31 Dec 2010 18:29:05 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_FONT_FACE_BAD,HTML_MESSAGE,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 74.125.82.171 as permitted sender) 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= MIME-Version: 1.0 Sender: 4wayned@gmail.com In-Reply-To: References: <997733.11083.qm@web65612.mail.ac4.yahoo.com> Date: Fri, 31 Dec 2010 10:28:59 -0800 X-Google-Sender-Auth: LP9xFhunlNPXD2XUL8rvPU3TKFM Message-ID: Subject: Re: How to get syntax highlighting working?? From: Wayne Davison To: Zsh list Content-Type: multipart/alternative; boundary=0016e65397aad67be80498b8f9e8 --0016e65397aad67be80498b8f9e8 Content-Type: text/plain; charset=UTF-8 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.. --0016e65397aad67be80498b8f9e8--