tags:

views:

2366

answers:

7

Hi

When I browse code, I need to see opening and closing parenthesis/ brackets, and pressing "%" seems unproductive.

I tried :set showmatch, but it makes the cursor jump back and forth when you type in a bracket. But what to do if I am browsing already written code.

Thanks

Aman Jain

+2  A: 

set showmatch is your best bet. you can also use the % command to jump between matching parenthesis, braces, brackets, quotes, etc.

jcoby
I mentioned in the question that pressing % every time is a pain
Aman Jain
+9  A: 
DoMatchParen

in your .vimrc file

or

:DoMatchParen

within vim itself.

Edit: This comes from the pi_paren plugin (which is a standard plugin).

Harley
but that doesn't seem to work with vim version 6.3 that I use at workCan you provide any suggestion for achieving the same functionality in vim 6.3
Aman Jain
Sorry, no. Your best bet would be to upgrade to a version of vim that's less than 5 years old. I'm pretty sure you could run it from a USB key if you wanted to.
Harley
A: 

there a nice patch out there called...

oh just forget it

Mark Lubin
psst...it was emacs
Mark Lubin
A: 

What's the difference between 'DoMatchParen' and the showmatch option?

I believe what the author wants is braces/parenthesis that are highlighted not only when the cursor is on top of a pair of braces, but also when the cursor is in a block of code that's engulfed by a pair of braces.

Is there such a plugin/option?

A: 

showmatch works for me, thanks jcoby

A: 

Maybe what you want is this plugin:

http://www.vim.org/scripts/script.php?script_id=350

Grissiom
A: 

But is there any better option than :showmatch and pressing % ...??