我目前正在写很多纯文本(以及LaTeX,段落中的格式最少),如果可以设置vim保留每个句子(为简单起见,文本以'。','!或“?”;这是一个终止标点符号,后跟一个空格,以避免在其自己的行上出现小数点),因此VCS差异将更加有用。
最少,我想gq
格式化以下文本:
He lay flat on the brown, pine-needled floor of the forest, his chin on his
folded arms, and high overhead the wind blew in the tops of the pine trees.
The mountainside sloped gently where he lay; but below it was steep and he
could see the dark of the oiled road winding through the pass. There was a
stream alongside the road and far down the pass he saw a mill beside the
stream and the falling water of the dam, white in the summer sunlight.
至:
He lay flat on the brown, pine-needled floor of the forest, his chin on his folded arms, and high overhead the wind blew in the tops of the pine trees.
The mountainside sloped gently where he lay; but below it was steep and he could see the dark of the oiled road winding through the pass.
There was a stream alongside the road and far down the pass he saw a mill beside the stream and the falling water of the dam, white in the summer sunlight.
但是如果vim在键入时也执行这种格式设置(就像它对textwidth reflow一样),那就太好了。这可能吗?
我当前的解决方案是使用来加入一个段落J
,然后运行:'<,'>s/\. /.\r/g
,由于没有感叹号和问号,因此运行起来相当不错,但是如果我可以使gq稍微聪明一点会更好。