

Ask HN: nroff wizards, how do you change Vim's paragraph definition? - tambourine_man

I've always hated that Vim distinguishes a blank line from an empty line in paragraph motion. This means that a line with only spaces or tabs will be skipped when using '{}'.<p>Googling has only shown similar frustration, but no solution.<p>This is my best shot and it kind of works, but it's an ugly hack, and it doesn't for Visual mode:<p><pre><code>   nmap } /^[ \t]*$&#60;cr&#62;:nohlsearch&#60;cr&#62;
   nmap { ?^[ \t]*$&#60;cr&#62;:nohlsearch&#60;cr&#62;
</code></pre>
:help paragraph says that it can be done, but requires nroff.<p><i>paragraph</i>
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).  A section boundary is also a paragraph boundary.
Note that a blank line (only containing white space) is NOT a paragraph
boundary.
Also note that this does not include a '{' or '}' in the first column.  When
the '{' flag is in 'cpoptions' then '{' in the first column is used as a
paragraph boundary |posix|.<p>While we're at it, ignoring email quote prefix would also be great.
======
tambourine_man
My best solution so far.

Vim has a better notion of what a paragraph is when in visual mode, so:

    
    
      nmap } vip<esc>jj
      nmap { vipo<esc>kk

