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!
Try delimitMate:
https://github.com/Raimondi/delimitMate
Some plugins listed here as well.. Plus instructions on setting it up yourself:
http://vim.wikia.com/wiki/Automatically_append_closing_characters
I use AutoPairs. You can get it here:
https://github.com/jiangmiao/auto-pairs.git
If you read the docs, it has a lot of options which cover most eventualities.
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.
I'm maintaining a plugin that simplifies insertion of balanced bracket-like characters, and that even supports surrounding of words/lines/selection.
https://github.com/LucHermitte/lh-brackets/#the-bracketing-subsystem
The default bindings for C & C++ are described in lh-cpp page.