3

Let's say I have that text in my file:

At vero eos et accusamus et iusto odio
dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et 
quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deser
unt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, 
cum soluta nobis est eligendi optio cumque nihil impe
dit quo minus id quod maxime placeat (*|*)
facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.

I want to reformat the whole paragraph with gq or sth similiar. But I want to have a defined paragraph at (*|*) . so Idon't want vim to reformat that line. How can I achieve that?

EDIT With a "defined paragraph" I mean sth like

At vero eos et accusamus et iusto odi dignissimos ducimus qui blanditiis
praesentium voluptatum deleniti atque corrupti quos dolores et quas
molestias excepturi sint occaecati cupiditate non provident, similique sunt
in culpa qui officia deser unt mollitia animi, id est laborum et dolorum
fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero
tempore, cum soluta nobis est eligendi optio cumque nihil impe dit quo minus
id quod maxime placeat. (*|*)
facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.

2. EDIT

formatoptions=a,t I've read also :h fo-table, but I couldn't find sth helpful yet.

3

Quick, easy way: Use visual select to select all lines in the paragraph, then press gq.

You could create a custom mapping that does something similar:

map <leader>k {mz/\(\*\|\*\)<cr> Ea<cr><esc>'zgw}

If you use this at any point in your paragraph, this mapping will:

{ 

Go to start of the current paragraph (Assuming new lines demarcate paragraphs)

mz

Mark current position

/\(\*\|\*\)<cr>

Search for your paragraph marker

Ea<cr><esc>

insert a new line at your paragraph marker

'z

Return to mark

gw}

Format to end of paragraph

At vero eos et accusamus et iusto odio
dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et 
quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deser
unt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, 
cum soluta nobis est eligendi optio cumque nihil impe
dit quo minus id quod maxime placeat (*|*)
facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.

Becomes

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis
praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias
excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui
officia deser unt mollitia animi, id est laborum et dolorum fuga. Et harum
quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta
nobis est eligendi optio cumque nihil impe dit quo minus id quod maxime placeat
(*|*)

facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
  • Hey, first of all - thanks. As your answer solves my question not perfectly, I'll wait another few weeks for alternative answers, until I'll mark your answer as accepted. – toogley Jan 11 '16 at 21:05
  • What is it missing? Your question description was rather vague. – fruglemonkey Jan 13 '16 at 12:44
  • Hey, as i wrote the comment, i didn't understand correctly how markdown works, so my request (the above without generating newlines) wouldn't have been possible. – toogley Jan 17 '16 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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