Vim
以與 format=flowed 兼容的方式包裝電子郵件文本,例如使用 par
我想使用命令行程序將電子郵件文本包裝成 72 個字元(以便重新格式化可以與
vim
. 報價使用>
需要很好地處理。超過 72 個字元的行應換行,短於 72 個字元並以空格結尾的行也應換行。不以空格結尾的行應該單獨放置,以便您可以編寫類似的內容
Best wishes, Greg
(後面沒有空格
Best wishes,
)沒有被包裹成一行。在換行的地方,應在末尾留一個尾隨空格,以便在使用
format=flowed
Content-Type
標題發送電子郵件時,電子郵件客戶端可以正確顯示。這是一些範例文本:
This is an example text file that I would like to reformat using par. I would like this paragraph wrapped to 72 characters because at the moment it's just one long line of text. > This paragraph should also be wrapped > to 72 characters because each line > except the last ends with a space. > The quotes should be handled nicely. These lines shouldn't be wrapped because they are shorter than 72 chars and don't have any trailing spaces.
par w72q
(下面的輸出)接近,但不會在行尾留下尾隨空格,並且會在沒有尾隨空格的情況下換行:This is an example text file that I would like to reformat using par. I would like this paragraph wrapped to 72 characters because at the moment it's just one long line of text. > This paragraph should also be wrapped to 72 characters because each > line except the last ends with a space. The quotes should be handled > nicely. These lines shouldn't be wrapped because they are shorter than 72 chars and don't have any trailing spaces.
Vim 實際上很好地處理了這一點,而無需求助於其他程序。以下選項很有用:
setlocal comments=n:> setlocal formatoptions+=aw setlocal textwidth=72
請參閱
:help format-comments
和:help fo-table
了解更多資訊。