You are not logged in.

#1 2012-12-14 06:54:08

ems5311
Member
Registered: 2009-10-27
Posts: 6

Vim parentheses quick highlighting?

Hi all,
On my previous linux installation my Vim install came with the ability to highlight parentheses and braces quickly in the editor. If the cursor was placed on a parentheses or brace, it would immediately highlight that character's corresponding parentheses or brace. I need this functionality now, but I can't figure out how to get it. The best I could do was find a vim plugin that lists the line number of the corresponding paren on the bottom of vim, which is nearly useless for what I need (I write a lot of scheme, and my code often has lots of nested parens on a single line). I remember in my ubuntu install I had this functionality.

What I believe this is NOT is:
DoMatchParen
showmatch (quickly jumps cursor to the matching paren when you put down a close paren. I need it to just highlight this while my cursor stays at its corresponding paren).

Thanks in advance for help,
Erich

Offline

#2 2012-12-14 14:04:50

Thanoulis
Member
From: Lamia, Greece
Registered: 2009-05-03
Posts: 33
Website

Re: Vim parentheses quick highlighting?

What I believe this is NOT is:
DoMatchParen
showmatch (quickly jumps cursor to the matching paren when you put down a close paren. I need it to just highlight this while my cursor stays at its corresponding paren).

Well, i believe you need the combination of showmatch and matchtime.
Matchtime (see :help matchtime) defines in tenths of second the matching "hop".
Set it a low number (< 5) and see if it suits you.


-- Beware of he who would deny you access to information, for in his heart he dreams himself your master.

Offline

#3 2012-12-14 14:34:21

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: Vim parentheses quick highlighting?

My vim does that by default.  At least, I never set it up to do so.

Looking through all my settings with :se all, I found matchpairs, which in my case is set to "(:),{:},[:]".  Maybe look into that.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#4 2012-12-14 14:44:27

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Vim parentheses quick highlighting?

ems5311 wrote:

The best I could do was find a vim plugin that lists the line number of the corresponding paren on the bottom of vim, which is nearly useless for what I need

You don't need a plugin for this functionality. I think my Vim configuration does what the highlighting thing you're looking for. If nobody answers your question before I get home then I'll let you know what my settings are.

But... I actually prefer to just use the "%" key. Put the cursor over a parenthesis or bracket and press "%" to move the cursor (back and forth) between the pair of characters.

Offline

#5 2012-12-15 00:40:16

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Vim parentheses quick highlighting?

I have

" Show matching brackets
set showmatch
set matchtime=3                 " Show matching brackets for only 0.3 seconds

Last edited by karol (2012-12-15 00:40:38)

Offline

Board footer

Powered by FluxBB