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?
Tamas Kovacs has created a Vim paredit script similar to the Emacs version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With