format = flowedと互換性のある方法で電子メールテキストをラップします。たとえば、parを使用します。

format = flowedと互換性のある方法で電子メールテキストをラップします。たとえば、parを使用します。

私は電子メールテキストを72文字で囲むコマンドラインプログラムを使用したいと思います(再フォーマットが統合されるようにvim)。使用された引用符は>適切に処理する必要があります。

72文字より長い行とスペースで終わる72文字より短い行は改行する必要があります。空白で終わらない行は、次のように書くために単独で残す必要があります。

Best wishes,
Greg

(後に空白なしBest wishes,) 1行で囲まないで。

行が途切れる場合は、末尾に末尾のスペースを残す必要があります。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.

ベストアンサー1

Vimは実際には他のプログラムに頼らずにこの問題を非常にうまく処理します。次のオプションが便利です。

setlocal comments=n:>
setlocal formatoptions+=aw
setlocal textwidth=72

詳しく見て知っ:help format-commentsてください:help fo-table

おすすめ記事