Hello, usually I will option draw a box around some text, press control-Q and it wraps it with hard line breaks. Handy.
I would like to define this in a more exact way, and set up a bundle that does the same thing, to selected text, at say, 80 chars wide. Not right on the 80 of course, take into account in the same way control-Q does, where a word ends.
Thanks.
On 2009-May-15, at 1:23 AM, Scott Haneda wrote:
Hello, usually I will option draw a box around some text, press control-Q and it wraps it with hard line breaks. Handy.
I would like to define this in a more exact way, and set up a bundle that does the same thing, to selected text, at say, 80 chars wide. Not right on the 80 of course, take into account in the same way control-Q does, where a word ends.
I don't know about selecting to a specific width (maybe a macro?), but you can certainly wrap to a specific width in a number of ways.
One way is to go to View → Wrap Column and set something there. Of course, that affects all files in all languages, but it works.
Another way is to make a command that runs the text through the `fmt` command. (Such a command probably already exists, so you might want to look around in the bundles.) You can then assign that command to all scopes, or just the ones you want to be different from the default.
Some bundles have already replaced ⌃Q, so you might want to see what they've done. For instance, the Mail bundle's re-wrap command knows how to wrap quoted lines beginning with one or more '>'. I modified it to always wrap at 74.
I have a quick and dirty way to do this:
- Record a macro. - Go at the beginning of the text with cmd-up arrow. - Select all text cmd-shift-down arrow. - Type alt to go to column selection. - Type cmd-shift-left arrow to select only the first column. - Type shift-right arrow until (now, it is inelegant) you have selected enough columns. - Type ctrl-Q to reformat. - Stop the record.
Now, you can save the macro in a bundle.
... I love macros.
Best regards, Mathieu
___________________________________________
Mathieu Godart
Skype: mathieu_godart MSN: mathieu_godart@hotmail.com
ASIC Integration Manager Coolsand Technologies ___________________________________________
Le 15 mai 09 à 14:52, Rob McBroom a écrit :
On 2009-May-15, at 1:23 AM, Scott Haneda wrote:
Hello, usually I will option draw a box around some text, press control-Q and it wraps it with hard line breaks. Handy.
I would like to define this in a more exact way, and set up a bundle that does the same thing, to selected text, at say, 80 chars wide. Not right on the 80 of course, take into account in the same way control-Q does, where a word ends.
I don't know about selecting to a specific width (maybe a macro?), but you can certainly wrap to a specific width in a number of ways.
One way is to go to View → Wrap Column and set something there. Of course, that affects all files in all languages, but it works.
Another way is to make a command that runs the text through the `fmt` command. (Such a command probably already exists, so you might want to look around in the bundles.) You can then assign that command to all scopes, or just the ones you want to be different from the default.
Some bundles have already replaced ⌃Q, so you might want to see what they've done. For instance, the Mail bundle's re-wrap command knows how to wrap quoted lines beginning with one or more '>'. I modified it to always wrap at 74.
-- Rob McBroom http://www.skurfer.com/
The magnitude of a problem does not affect its ownership.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate