3 ms·
Ask HN: nroff wizards, how do you change Vim's paragraph definition?
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 '{}'.
Googling has only shown similar frustration, but no solution.
This is my best shot and it kind of works, but it's an ugly hack, and it doesn't for Visual mode:
nmap } /^[ \t]*$<cr>:nohlsearch<cr>
nmap { ?^[ \t]*$<cr>:nohlsearch<cr>
:help paragraph says that it can be done, but requires nroff.
paragraph
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|.
While we're at it, ignoring email quote prefix would also be great.
- tambourine_man 15y agoMy 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