Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the "paragraph macros" in :help paragraphs

Tags:

vim

vi

Running :help paragraph in vim gives:

A paragraph begins after each empty line, and also at each of a set of paragraph macros, specified by the pairs of characters in the 'paragraphs' option. The default is "IPLPPPQPP TPHPLIPpLpItpplpipbp", which corresponds to the macros ".IP", ".LP", etc. (These are nroff macros, so the dot must be in the first column).

Most of the vim help I've seen has been super helpful, and I was beginning to feel I was getting a grip on it. Suddenly though:

IPLPPPQPP TPHPLIPpLpItpplpipbp

Aaand I'm lost.

Could someone explain to me what this sequence of characters is supposed to mean?

like image 293
RichardTowers Avatar asked Oct 18 '25 13:10

RichardTowers


1 Answers

nroff(1) is a unix text-formatting utility. It's e.g. used for formatting the man pages.

In nroff, you got macros that do stuff: e.g. .PP means following is a paragraph with the first line indented. These macros are usually(1) 2-letter codes preceded by a dot.

The docs are saying how Vim detects paragraph boundaries: A paragraph boundary is either an empty new line or a dot in the first column followed by one of the 2-letter codes specified in the paragraphs option.

Example:

Hello
LP
World

If I put the cursor on World and enter vip in normal mode. Everything will be selected.

Hello
.LP
World

.LP is contained in the paragraphs option, thus vip will in this case not mark Hello as it's above the paragraph boundary.


(1) For 1-letter macros, you append a space. That's why there is a space in the default paragraphs value, it's for .P.

like image 152
a3f Avatar answered Oct 21 '25 04:10

a3f



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!