Xiaotian Guo
Xiaotian Guo

Reputation: 1645

vim plugin for inserting new line after "{{"

I have recently changed to use pathgen.vim and git submodule to manage my plugins. after I h ave done this I noticed vim no longer insert new lines when I type 2 "{" in a row to open a function body, for example: "|" is the cursor

function()| type "{" I get

function(){|}  as I have AutoClose.vim enabled.

however if I immediately type the second "{" I only get

function(){{|}}

instead of

function(){
  |
}

I expect

I have the same vimrc file as before the pathgen.vim and git submodule migration. I am wondering which plugin was responsible for this feature?

I have found reason why it no longer works for me, I was using a different implementation of autoclose.vim. While it does provider the {{ auto new line feature, it's got some weird behavior that I have decided to settle with the popular version in github, which doesn't have this feature.

Upvotes: 0

Views: 166

Answers (1)

1983
1983

Reputation: 5963

You could just map it yourself in your vimrc:

:autocmd FileType c,java,javascript ino <buffer> {{ <C-G>u{<CR>}<Esc>O<C-T>

Change the filetypes to suit. However this could potentially interfere with autoclose.vim. You'd have to try it and see. As to your original question, I don't know which plugin might have given that original behaviour, Vim has so many. Hopefully somebody else here will recognise that behaviour.

Upvotes: 1

Related Questions