On 7/7/2006, at 4:50, Di Xiao wrote:
I just start using Textmate and find the Reformat Paragraph command a little bit confusing. When editing a text file, I usually leave two spaces at the end of a sentence, but after "Reformat Paragraph" it will leave only one space.
It leaves one spaces? For me it removes them all. It really is a “squeeze successive whitespace and newlines into one space, word wrap this, and strip leading/trailing space” -- though some exceptions for when the paragraph looks like a bullet item, or when it’s indented, or when there is a column selection…
Since I've used emacs for quite a long time, it's natural to compare with the fill-paragraph command in emacs. The behavior in emacs is (1) if there is one space after a sentence, fill-paragraph will do nothing; (2) if there is more than one space, fill-paragraph will change it to two spaces.
What is the point of these trailing spaces?
Is there a way to change the behavior of "Reformat Paragraph" to match fill-paragraph in emacs?
No -- it is however possible to override it. Create a new command with input set to “Selection or Scope” and scope selector to “meta.paragraph” -- then the command gets the current paragraph (in plain text documents) as input (stdin) and can reformat it however it wants.
Here’s a simple example (click to install):
I searched the mail archive and find there was a discussion on Reformat Paragraph in LaTeX mode. I agree that the current implementation of Reformat Paragraph is completely useless when math mode or other enviroment is inside a paragraph. Is anything going to change for that?
If so, it will happen through a scope specific override (placed in the LaTeX bundle) using the same approach as outlined above.
Currently though no-one is working on it.