I want to join all the lines within a {}
block.
{
'a': 1,
'b': 2,
'c': 3,
}
⬇︎
{ 'a': 1, 'b': 2, 'c': 3, }
Since J
doesn't take a range, like d
or c
, the best command I found to do this is going through virtual mode: Va{J
.
Is there a nicer way to do the same?
This is not a duplicated of Why doesn't gJip turn a paragraph into a line? since that question doesn't ask how to turn a paragraph into a line. The proper answer of that question is "gJ
doesn't work like that".
J
takes a count...that's not what you're looking for? Note thatd
andc
don't take ranges. They take motions (including count). Do you mean motion rather than range? (there's also:join
which takes a range and/or a count so if younmap
that it might work for you.) – B Layer Apr 27 '20 at 10:535J
from the opening `{`` not to your liking? – B Layer Apr 27 '20 at 11:00[count]J
was acceptable so I asked. – B Layer Apr 27 '20 at 20:26