Reputation: 6807
How do I emulate Sublime text's auto complete behavior for curly braces {}
on vim? Basically, when a parenthesis is opened, it should auto close in the same line, and when <CR>
is pressed the cursor should go to the next line with a block indentation and }
should fall in line with the original indention of the line containing the {
. If my question is not clear, this is the default behavior of most code editors when dealing with {}
.
Upvotes: 2
Views: 1278
Reputation: 32946
There exist many plugins with similar features as Ingo pointed out.
lh-brackets, that I'm maintaining, has the features you describe:
{
inserts {}
and moves the cursor in between (and also inserts a placeholder after the closing bracket<cr>
while within a pair of curly-brackets will insert another newline in-between (and indent correctly)Upvotes: 1
Reputation: 172590
The Automatically append closing characters page on the Vim Tips Wiki has everything from simplistic mappings to complete plugin solutions. There seem to be issues with the latest Vim 7.4 version, though.
Upvotes: 5