Not really a problem so let's write a simple command for this. And here is the result. I don't know if it works in all cases, but I tested it for situations where nothing is selected or whole lines are selected and it seems to work there.
Warning: Don't try this command when you don't have full lines selected. This command wasn't built for this and I haven't yet found a way to check what kind of stuff got selected :) And don't try it on program source code ;-)
!/usr/bin/env python
import os,sys from sys import stdout,stdin
def split_line(line,max_len,tab_size): if len(line) <= max_len: return [line,]
prefix = '' prefix_length = 0 if line[0] in (' ',"\t"): for c in line: if c not in (' ',"\t"): break else: prefix += c if c == '\t': prefix_length+=tab_size lines = [] current_line = [] line_no = 0 words = line.split(" ") chars = prefix_length if len(words)==1: return [line,] while len(words) > 0: if (chars+len(words[0])) <= max_len: word = words.pop(0) current_line.append(word) chars += len(word)+1 else: if line_no > 0: lines.append("%s%s"%(prefix," ".join(current_line))) else: lines.append(" ".join(current_line)) current_line = [] line_no+=1 chars = prefix_length if len(current_line) > 0: if line_no > 0: lines.append("%s%s"%(prefix," ".join(current_line))) else: lines.append(" ".join(current_line)) return linesif name == 'main': max_len = int(os.getenv('TM_WRAP_LENGTH',78)) tab_size = int(os.getenv('TM_TAB_SIZE',4)) for line in stdin: stdout.write("n".join(split_line(line,max_len,tab_size)))
And here's the configuration for this command. I simply put it into a dummy bundle handling all my private extensions to the "Text" bundle ... well, actually this is the first extensions ;-)
Warning: The usual stuff. Use this on your own risk etc.
I hope this might be useful for some of you :-)

It believe this is built in to TextMate, Horst.
Take a very long line and highlight the first 80 chars or so.
Press the Option key once and release. This turns it into a column selection, but nothing apparent will change on screen.
Control-Q. The line is broken up into multiple lines.
It works if the text is indented too, whether that be Tabs or Spaces. Just begin your selection at the first non-whitespace character. The left margin it creates will be lined up with the left side of your selection.
Nov. 24, 2009, 8:54 p.m.
Thanks, but If you take a look at the date of this post you will notice that it is about 3 years old. Back then, IIRC, the behaviour of the built-in command was perhaps not really what I wanted out of it. Or it wasn't even included back then :-)
Nov. 24, 2009, 8:59 p.m.