40

Right now I'm working with some blocks of text that are over 1000 lines long. Is there a simple way to move to the beginning of the next paragraph?

My workaround for now is searching for two consecutive newline characters:

/\n\n

Another workaround would be vip Esc j

  • vip visually select in paragraph (which also takes you to the end of the paragraph)

  • Esc Escape from visual selection

  • j move down

1 Answer 1

59

Yes, you can use the } and { paragraph motions to move a paragraph forwards or backwards.

From :help 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.

Like you would expect, you can of course add a count and/or operator; eg. 2} to move 2 paragraps fowards. Or to delete the previous 2 paragraphs you can use 3d{.

Also see :help object-motions

2
  • 3
    Side note: very useful for programmers is also [[ and ]] (as well as [] and ][) to jump between beginning (and end) of functions.
    – Shahbaz
    Mar 5, 2015 at 15:53
  • 2
    Unfortunately those function-jumping motions only really work if the opening brace is in the first column. I worked somewhere which put the functions' opening braces at the end of the function declaration line and the suggested tweaks in the docs never worked terribly well. :( Oct 6, 2017 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.