Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim plugin for 'auto-closed' parenthesis?

I've searched near and far, and not found a plugin that can simply auto-close a set of parenthesis like Textmate. For example:

Vim     : (*manually close parens* → )
Textmate: (*Auto closes parens*)

If you can describe a plugin for this, I will be very helpful. Thanks!

like image 940
beakr Avatar asked Jan 22 '12 01:01

beakr


People also ask

How do I automatically close brackets in vim?

This autocomplete in insert mode, provided set paste is not set. Keep it in the vimrc to avoid typing it every time and when we don't want the mapping, we need to escape it using ctrl + v before typing the mapped char like ( { etc.


1 Answers

For those of us who want to go the plain vim way:

ino " ""<left>
ino ' ''<left>
ino ( ()<left>
ino [ []<left>
ino { {}<left>
ino {<CR> {<CR>}<ESC>O

This autocomplete in insert mode. Keep in the vimrc to avoid typing it everytime and when we don't want the mapping, we need to escape it using ctrl - v before typing the mapped char of ( { etc.

like image 155
dlmeetei Avatar answered Sep 21 '22 13:09

dlmeetei