I want to indent lines in each paragraph except the first one.
By paragraph, I mean a group of lines that are separated from other groups of lines by at least one blank line.
For example, here we have three paragraphs:
paragraph1
line1.1
paragraph2
line2.1
line2.2
paragraph3
I want to indent all the lines except the first one in each paragraph. To do this, I use the following command:
g/^\w\+/+1,/^\s*$/>
The problem is that this command indents every line progressively. The result is as here:
paragraph1
line1.1
paragraph2
line2.1
line2.2
paragraph3
line2.2
is indented twice. I guess this occurs because global command matches all lines first with the regex ^\w\+
, then it applies the command +1,/^\s*$/>
.
How can I produce the following output?
paragraph1
line1.1
paragraph2
line2.1
line2.2
paragraph3