Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Match paren
- X-seq: zsh-users 17929
- From: Jérémie Roquet <arkanosis@xxxxxxxxx>
- To: shawn wilson <ag4ve.us@xxxxxxxxx>
- Subject: Re: Match paren
- Date: Fri, 16 Aug 2013 16:51:38 +0200
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=Yb0QpdQwnK6AFvNFDOkIQSdNKFnIMItQ84B1fGKRqwI=; b=sRhPAO7bMy/0JWu2tpYdF5RWu8oLI0kR1ygZiL3VNgyz1H8Mhzz6dIwrrsGeY4s77b LycnoHw7pgFU9nPkAinnsEp1HLN/S3eZFPrRAxuFVhU2s+vlhMcOs5T08wqYxf3qLfB1 PEfPhLKaTcxgrHRkCA26fmXiy/fK6xwAHDpwqnw8cu9E9h5/mnDaotwUS1iYTJyOapc2 agjwcEgcPkYjOCX1Bj5KDBu21jejd+VCu/rcj4FIL0WcNoxFFDTcTCP2vTK3xyQ+TBWr YuzVsnL2Ms2lDc22vtuRJQZQeTalAQ73nR9zjWoiFAuNyoTnASq1ejRKwvV9Yv84Z26d Ka9A==
- In-reply-to: <CAH_OBicvEpj2wZTGo9LCa59sh7aipeR-G807P3D9pN=4X783QA@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAH_OBicvEpj2wZTGo9LCa59sh7aipeR-G807P3D9pN=4X783QA@mail.gmail.com>
Hi,
2013/8/16 shawn wilson <ag4ve.us@xxxxxxxxx>:
> Has anyone made a script or omz plugin that visually highlights
> matching parens, brackets, and curleys? I know this is being done
> somehow as % works to move between them. However, I'd like to see the
> match when I hover over it.
The following code highlights the matching symbols when you type them.
Unless I'm mistaken, it was originally written by Oliver Kiddle.
function highlight-paren()
{
local i nested=1
typeset -A match
match=(
\) \(
\] \[
\} \{
\" \"
\' \'
\` \`
)
zle self-insert
for ((i=$((CURSOR - 1)); i; --i)) {
[[ $BUFFER[$i] = $match[$KEYS] ]] && (( ! --nested )) && break
[[ $BUFFER[$i] == $KEYS ]] && (( ++nested ))
}
region_highlight=("$((i-1)) $i standout")
zle -R
read -kt 1 && zle -U "$REPLY"
region_highlight=()
}
zle -N highlight-paren
Best regards,
--
Jérémie
Messages sorted by:
Reverse Date,
Date,
Thread,
Author