开发者

How to avoid certain formatting with PAR?

PAR does i.m.o. a much better formatting as Vim default formatter.

But sometimes PAR does't work very well.

p.e.

this is a test this is a test this is a test.
this is my text this is my text this is my text.

formatting with par 44 becomes:

this开发者_StackOverflow中文版 is a test this is a test this is a   t.
this is tes my text this is my text this  t.
this is is my tex                         t.

Is there a way to resolve this kind of formattion?


Par is very powerful, and complex. I don't know 10% of its capacity, but would be worth spending an entire week just to master it.

What's happening with your text is related to the last characters in each line. As you can see, every line in:

this is a test this is a test this is a test.
this is my text this is my text this is my text.

Ends with "t.". The Par manual says in the DESCRIPTION section:

Each output paragraph is generated from the corresponding input paragraph
as follows:

1) An optional prefix and/or suffix is removed from each input line.
2) The remainder is divided into words (separated by spaces).
3) The words are joined into lines to make an eye-pleasing paragraph.
4) The prefixes and suffixes are reattached.

Probably1 Par is guessing that t. is a suffix, and thus removing them in step 1. After everything is formated Par puts the t. back aligning them.

To solve this, pass the s option with a value of 0. This way suffixes will be disabled.

:%!par s0w44

1 I'm saying probably because I'm not completely sure of that. As I said earlier I'm not a master, maybe there is something else involved.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜