[TxMt] Automagically figuring out tab size?

Allan Odgaard throw-away-1 at macromates.com
Wed Nov 16 18:27:03 UTC 2005


On 16/11/2005, at 19.16, chris feldmann wrote:

> I hesitate to suggest this, but how about modlines ala emacs or vim?
> /* vim:set ts=4 sw=4 nowrap:  */

Eventually I'll probably support something like that -- but generally  
other users haven't made the proper settings lines in their files.  
I.e. the problem with wrong tab size happens when opening some random  
file from the net (or friend).

> What other clue would textmate use anyway?

It can check the ratio for spaces versus tabs in the file to figure  
out if soft tabs should be enabled. If soft tabs are enabled, it can  
look at a few lines to figure out the size.

It won't be able to figure out the tab size (for hard tabs), but this  
is less important. I.e. the main problem is inserting spaces in a  
tabbed file or vice versa, and for spaces, inserting the wrong number  
of spaces for indent.

Now if just everybody would use hard tabs (as God intended), there  
would be no problems :) one would still need to set the proper size,  
but no-one would “destroy” the file by editing it with wrong settings.





More information about the textmate mailing list