[TxMt] Add Line Breaks

Robin Houston robin.houston at gmail.com
Tue Nov 20 22:23:12 UTC 2007

If you don't need to worry about dealing properly with (hard) tabs,
then you can easily write a short command to do the reformatting.

Set input to "Entire Document", output to "Replace Document", and put the code

#!/usr/bin/perl -p
print "$1\n" while s/(\S{$ENV{TM_COLUMNS}})//;
print "$1\n" while s/(.{0,$ENV{TM_COLUMNS}})\s//;

into the Command(s) box. This will treat a tab as though it took up a
single column, so if you have a lot of tab indents then it will leave
excessively long lines. Writing something that deals properly with
tabs would be a bit harder, but very possible.

(I bet somebody has already done it too!)


More information about the textmate mailing list