My vimrc about wrap is set like this:

set wrap "Wrap lines
set breakindent " indent after line wrapped

But the wrapped lines are not equal in length, such as:

line 1:   some contents ..... <end>
          continued line ..... other contents <end>
line 2: ....

The line 1 and its wrapped line does not agree in length, and neither of them is as long as the longest length the window provides.

Sometimes when I write Chinese characters, the line just wrapped at the position of space even though it is not finished, like this:


or like this:

line 1: 地地地地地地地地地地地地地地地地地地地地地地地地地地地地地地地地地地地寺地
line 2: ...

How could I make the wrapped lines the same length, and thus make the paragraph a shape of rectangular?

  • 2
    Possible duplicate of Can I justify text in Vim? – Herb Jan 24 '18 at 4:53
  • @HerbWolfe Sorry, I did not see explicit relation between that question and mine. Would you make it clearer? – CoinCheung Jan 24 '18 at 10:11
  • What you are asking for is called full justification. – Herb Jan 24 '18 at 12:05
  • 1
    @HerbWolfe I know, and how about my second problem about Chinese characters or a combination of Chinese and English? The wrap points fall on the wrong places of where spaces are in stead of the Chinese word at the length of the line. – CoinCheung Jan 24 '18 at 12:37

For the second problem, try set formatoptions+=m.

Also see this for reference.


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.