So my question is, what is it about the command:

:g/^>/+,/^>[EMAIL PROTECTED]/-1! par 72q

Which causes this to happen?  I've tried changing it but the
result is always the same.

This is a result of "par" [rightly, as it's a non-trivial task] not knowing how to deal with shell-code.

As to why it does correctly handle ">" quoting, par was built to handle such cases, so it gracefully considers "leader" characters. By default, I believe par considers whitespace, a ">" and the pipe character as its default set of "leader" characters that it will treat in a similar fashion.

The "par" utility is a rather complex tool with piles of nobs and dials for the twiddling. In most cases, the default does what is wanted. However, I don't believe there's any "intelligent" way for it to detect scripts within quoted text.

If you have some means of determining the beginning and ending of a script, one might be able to tweak the regexp ranges in the above command to accomodate them, though you might have trouble then if the quote contains more than one script. Maybe.

To see what's going on, simply write an excerpt of a quoted script to a file and simply run it through par, as Vim is doing for each block in question. You'll notice that par is what is doing the mangling. For just reformatting purpose, it's conceivable to use vim's internal reformatting--however, it too lacks the superpowers to discern code from non-code in a quotation.

The short answer, sadly, is "I'm afraid there's no nice way to do this".


-tim



Reply via email to