given the following:
{
int a = 123;
int b = 456;
}
i want to change it to:
{
int a = 123;int b = 456;
}
if i was using a regular text editor, i would go to the 2nd line, then Home, Shift+Up,Shift+End,Delete
what's vim way of doing this? it should work with any amount of whitespace between line 1 and line 2.
Try the J
command. It joins two lines (applied on the first one).
If you want to join two lines, separated by several empty lines easily, you can also select the lines between the two in visual mode (V
) and then apply J
.
However, that command inserts one space between joined lines (in most cases...).
For your requirements, you can use the variant gJ
which does not insert (or remove) any space between the lines.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With