Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keeping parentheses balanced (Paredit for Vim?)

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?

like image 613
Brian Carper Avatar asked Jan 16 '09 18:01

Brian Carper


1 Answers

Tamas Kovacs has created a Vim paredit script similar to the Emacs version.

like image 64
Jeremy Avatar answered Oct 06 '22 03:10

Jeremy