views:

673

answers:

2

Emacs has Paredit which actively prevents you from typing unbalanced parentheses (short of C-Q ( to force-insert a literal one, or other craziness). Inserting an open paren also inserts a closing one. Backspacing over a paren either deletes both the opening and closing paren, or neither. There are shortcuts to wrap a bare word in new parens, kick a word out of currently enclosing parens, expand parens to slurp up more nearby words, and so on.

Something like

imap ( ()<Left>

can get you started in Vim. But what's the best way to emulate some of the other more powerful features of Paredit in Vim?

+2  A: 

This might help as well: http://www.vim.org/scripts/script.php?script_id=2009 And there is another script: http://www.vim.org/scripts/script.php?script_id=2373

HTH

Zsolt Botykai
+1  A: 

May I suggest my bracketing system?

NB: prefer to fetch it directly from the svn repository, the new version is much more easier to tune to our needs.

If you are interested in the details/do-it-yourself-way, have a look at the related tip on vim.wikia.

Luc Hermitte