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?
I don't know if it's the best way to do that, but you could place your cursor on the
if
line, and doShift+J
(in normal mode) to join the current line to the next one.