Friday, September 15, 2006

The fix submitted before isn't reliable. That piece of magic in .vimrc does the job:

let loaded_matchparen = 1

It tells some plug-in/script/whatever that it has already did the job. If you put that in .vimrc - it would think that way always and would not load anymore. Nice.

P.S. The Tip was found here :help pi_paren.txt. It would be all really nice if computers had a special interface to read my mind - and tell me how the devels named particular feature. That way I will not need to waste weeks to find the corresponding help entry.

Paren matching is implemented quite simply in VIM - there is NO complete on-the-fly syntax parsing of whole file like done in Emacs.

The trick is simple. For example, unmatched '()' are caught as '({' or '([' - in other words inside of parens curly brackets may not occur. Same goes for square brackets.

To catch the case of unmatched '{', one would need to scan whole file, and yet the unmatched bracket would appear as if it was in the end of function/file. The curly brackets may have occurrences of other brackets inside, so the trick used for '[]' and '()' doesn't work.

P.S. I heard someone did something similar for case of properly indented file - when lines with opening and closing curly brackets are indented identically. I will try to think about it and if something would come to my mind, I'll post it.

Thank you so much for this! I just recently upgraded 4 machines (2 Linux, 2 OS X) and the latest OS versions apparently all shipped with VIM 7. This abomination has been driving me nuts until I finally found this page! I already know about the % command and I can do my own matching in my head anyway, thankyouverymuch. I don't need that monstrous $#!@ing distraction every single time the cursor happens to go over a paren or bracket! Sheesh.

I agree with skaven about whoever made this the default -- while I'm fully against the death penalty, I'm willing to make an exception in this case!

Thanks a bunch! I enjoy the matching parentheses feature, but my 2.0 GHz machine was lagging and not moving the cursor as quickly as it should be able to when moving the cursor around over a bunch of parentheses, so I had to get rid of it.

Quote :It would be all really nice if computers had special interface to read my mind and tell how devels named particular feature. That way I would not need waste weeks to find corresponding help entry.: End Quote

That special interface comes in the form of your kind self for writting about this fix and google making it searchable.

I thank you, google and lots of others for making that special interface.

Vi(m) has been around for a number of years and is one the few pieces of software that a really mature. However, everytime I install a new version of linux I have to spend time dis-improving it.Thank you very much for your help!p.

Hey, can anyone tell me how to turn on paren-matching-highlighting? Personally I find it difficult to match all of my parens. I'm not writing in scheme or anything, but I think it'd still be handy. thx!

For those looking to pair parens/brakets/etc, I do not know how to make this happen in your syntax file (via coloring). However put your cursor on a paren in command mode (not insert), use [shift]+5, and it will zoom the cursor to the matching pair.