문제

I use autoformat (textwidth = 72) to write my emails in vim.

The problem is that every time I write a list or short phrases, vim joins it to the line above.

p.e.

These are my options:
- option nr. 1

When I write "-", the "-" is immediately joined with the phrase above:

These are my options: -

Same when I use other kind of lists p.e. numbered lists or other symbols before the list.

Same thing when I write phrases shorter then 72 characters p.e.

This is my text.
This is my text on the 2nd line.

Autoformat changes it to:

This is my text. This is my text on the 2nd line.

How can I change this behavior?
I only want to format long lines when there are no Carriage Return <CR> in the first 72 characters.
If there is a <CR> it has to break there.

도움이 되었습니까?

해결책

:help autoformat gives some useful hints:

  • You need to properly define paragraphs. The simplest is paragraphs that are separated by a blank line. When there is no separating blank line, consider using the 'w' flag and adding a space at the end of each line in the paragraphs except the last one.

So, either :setlocal fo+=w, or turn off autoformat (maybe only temporarily, with a quick toggle mapping).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top