简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM