[TxMt] Lining up code automatically - perl mainly

Steve King sking at arbor.net
Fri Dec 7 14:28:21 UTC 2007


Simon Holroyd wrote:
> I've just started using TM, previously I used emacs. When I typed a perl
> line like:
>
> my $p = Base::Sub->new
>   (id     => 1234,
>    name => "test");
>
> I would only have to hit tab on each new line to move the cursor to below
> the appropriate place on the above line i.e. it auto formatted the code for
> me. TM doesn't seem to do this, which is annoying the hell out of me. Can
> someone help please?
>   

Hmmm...  It works fine for me, but I use a different indentation style. 
I tried typing in that fragment you sent, and this is how TM formatted
it for me:

my $p = Base::Sub->new
(id => 1234, 
    name => "test");


In case the mailer screws up the formatting, the second line is flush
with the left margin, and the third line starts with the cursor indented
by one (soft) tab stop.

Normally I'd break the line differently, leaving the opening parenthesis
on the first line.

my $p = Base::Sub->new(
    id => 1234,
    name => "test");


Both the 2nd and 3rd lines and indented one tab stop.  In both cases, if
I hit another return and continue to type, the 4th line is also indented
(which it shouldn't be).  So the auto-formatting does work, though it's
pretty dependent on your idea of style matching that of the the bundle
author. There's definitely room for improvement.

(And a stupid is-it-plugged-in question: You *are* in Perl mode, right?)


-- 
Steve King
Sr. Software Engineer
Arbor Networks
+1 734 821 1461
www.arbornetworks.com <http://www.arbornetworks.com/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20071207/5c9ce7d2/attachment.html>


More information about the textmate mailing list