C++ block with VIM surround plugin

83 Views Asked by At

I know how to use vim's surround plugin to add brackets to a c++ block as follows:

before:

if (condition)
    bla1
    bla2

after:

if (condition)
{    
    bla1
    bla2
}

But what if I want the end result to be:

if (condition) {    
    bla1
    bla2
}

What is the best way to do that?

1

There are 1 best solutions below

1
On

I don't know if it's the best way to do that, but you could place your cursor on the if line, and do Shift+J (in normal mode) to join the current line to the next one.