Kurt Keller's Blog

tech notes and more

matching parentheses

Have you seen in vim that it quickly jumps to the matching opening parenthesis ({}()[]) when typing a closing parenthesis? Useful when writing code. Helps to minimize syntax problems. In case your installation is not set up to do this you can enable it easily. If you just want to enable it temporarily for the current editing session, use the command :set sm. Better, though, if you enable it in your .vimrc file for all editing sessions:

:set showmatch          " show matching opening parenthesis when
                        " typing a closing parenthesis

But I hate it if vim highlights matching parentheses when I simply move through a file, it distracts me if something lights up somewhere else. If I dislike something, I try to get rid of it. It turns out this is easily disabled. The highlighting of matching parenteses is done in a standard module. In your .vimrc file just disable the loading of the plugin with

:let loaded_matchparen = 1
                        " disable highlighting matching parentheses

If the cusor currently is on a paranthesis and I want to see where its matching partner is, I simply use the % command.

% jump to matching parenthesis
Share

Leave a Reply