Hi,
I have some text. I know I can use TextMate to do first Soft Wrap (and I set the colums to 80). Then, I select the whole text and do Reformat Paragraph and Justify.
But after this, I don't want the justification to occur at the last line of a paragraph. Therefore, I manually select the last line of every paragraph and do Reformat Paragraph on those. Is there a way to automate this last process, that is do Reformat Paragraph on all last lines of all paragraphs?
Also: How would I be able to do this without TextMate, i.e. in the command line? I'm interested in that because I would like to create a PHP script that does exactly this.
Cheers, Ulai
_________________________________________________________________ Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/
On 16. Nov 2006, at 19:49, Ulai Beekam wrote:
I have some text. I know I can use TextMate to do first Soft Wrap (and I set the colums to 80). Then, I select the whole text and do Reformat Paragraph and Justify.
But after this, I don't want the justification to occur at the last line of a paragraph. Therefore, I manually select the last line of every paragraph and do Reformat Paragraph on those. Is there a way to automate this last process, that is do Reformat Paragraph on all last lines of all paragraphs?
You can record the actions as a macro, do a regexp search for (?=\n\n| \z) to get to the end of last line.
I did one for you (click to install):
Also: How would I be able to do this without TextMate, i.e. in the command line? I'm interested in that because I would like to create a PHP script that does exactly this.
From the command line, to collapse whitespace (and newlines) into one space, and then wrap at the last space before column 80, you would do:
tr -s '[\n ]' ' '|fold -sw80
To then distribute spaces on all but last line, well, you need to write some code… :)