[TxMt] Reformat Paragraph and Space at the End of a Sentence

Di Xiao dixiao at gmail.com
Fri Jul 7 18:20:01 UTC 2006


On 7/7/06, Allan Odgaard <throw-away-1 at macromates.com> wrote:
> 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…

I meant the space after a sentence, i..e, after a period, not a
paragraph.  The reformat paragraph command will remove all the spaces
at the end of a paragraph as expected.

>
> > 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):
>

Thanks.  That's the exciting thing about TextMate -- There is always a
way to do it.

>
>
>
> > 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.
>
>
>
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
>
>
>



More information about the textmate mailing list