I've had a look at :h matchparen, and it doesn't seem to have an option for highlighting the match for the parenthesis immediately before the cursor. In short, this is what I want:

  1. Matchparen should try to match the paren before the cursor if it exists.
  2. It should default to the one under the cursor otherwise.

This would be very helpful for writing Lisp. It would be a plus if it did the above in insert mode, but went back to the default behavior in normal mode.

Just to clarify, this does not need to affect the behavior of %, and preferably should not.

1 Answer 1


You should try Rainbow Parenthesis : Highlight matching parens in a rainbow of colors (or one of its clones):

This script highlights matching parenthesis with a rainbow of colors. This make it visually very obvious which matches what. Most useful for Lisp.

It highlights all the parenthesis, not only the one before the cursor. Nonetheless, it could help on your task.

Another alternative is Limp : Lisp IDE:

It will do this for you:

  • booting/attaching/detaching a Lisp (SBCL) from Vim or a command-line script, optionally specifying a core;
  • send code to the attached Lisp (and limited introspection, see Help Describe);
  • automatically close brackets;
  • ease s-exp navigation and (some) transposing;
  • highlight current form under the cursor;
  • lookup documentation from the HyperSpec;
  • complete (some) names.

There are several plugins on vim.org which you may find helpful.

  • Rainbow Parenthesis doesn't quite make it obvious enough which paren is being matched (although I'll try it anyway); Limp seems a bit heavy for this purpose (I already use language-agnostic scripts like ConqueTerm, Syntastic, etc. for IDE-like features). Commented Feb 18, 2016 at 23:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.