Mainstream editors usually place closing curly brace on the new line automatically while entering function bodies and conditional constructs in languages with curly braced syntactic blocks. Vim/Neovim doesn't. Which plugin provides the feature?

Mere i-mapping isn't desirable because curly braces used not only for blocks and new line shouldn't be inserted in such cases.

Mainstream editor

function foo() {


function foo() {
  • 1
    – filbranden
    Jan 6, 2021 at 6:57
  • @filbranden that's an option. By I am using coc-pairs and they seem to be incompatible. Coc-pairs seems to be supperior in brackets automation because of its language awareness. So would like to know other solutions
    – vatosarmat
    Jan 6, 2021 at 7:20

1 Answer 1


If using Coc - formatOnType should be enabled and special i-keybinding set, details here https://github.com/neoclide/coc-pairs/issues/13
If not - https://github.com/jiangmiao/auto-pairs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.