[TxMt] Code folding for Python?

Alex Ross alex.j.ross at gmail.com
Tue Oct 30 01:21:22 UTC 2007


> Please forgive me if this has been asked and answered before... But  
> is there any way to fold your code normally when using TM for Python?

Well, yeah... this comes up from time to time.  But since you asked,  
I'll forgive you.  ;-)

The short answer is “no”.

The longer answer is that Textmate folds by looking for “Start” and  
“End” markers.  Python folding is indentation based, but Textmate has  
no way of reliably matching that.  So we have some hacks that don't  
really work.

> Any tips from my fellow Pythonistas?

You can use the “Cleanup Whitespace” command.  This command does what  
it can to put the file in a state where the hacks can kinda-sorta fold  
your code.

But don't lose hope!  At some point in the future, the folding system  
is getting an overhaul.  Things will be better then.

– Alex





More information about the textmate mailing list