George B.
George B.

Reputation: 595

C++ block with VIM surround plugin

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?

Upvotes: 0

Views: 87

Answers (1)

Apitronix
Apitronix

Reputation: 273

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.

Upvotes: 1

Related Questions