I’ve set textmate to use softtabs 2 spaces on my file. But when I try to reformat the entire document, it uses 2 hard tabs as the indents.
Regular indents work as I want it to, just the document format doesn’t. Anyway to get textmate to be obedient?
Thanks.
The JavaScript bundle’s “Reformat Document / Selection” command is passing the document’s text to the js_beautify function in the bundle’s beautify.php file (found on my system and probably by default at
/Applications/TextMate.app/Contents/SharedSupport/Bundles/JavaScript.tmbundle/Support/lib/beautify.php). If you take a look at the function definition you’ll see that there’s a second parameter, $tab_size, with a default value of 4. There’s a line in the bundle that readsprint js_beautify($input);. Change this toprint js_beautify($input, 2);and you should, I expect, get tab stops with two spaces.To make it a bit more flexible, use the TextMate environment variable TM_TAB_SIZE, as in
print js_beautify( $input, getenv('TM_TAB_SIZE' ) );, which should update how the command operates if you ever change your tab size.Note, I’ve tested none of this. 🙂 Just took a look at the bundle and tracked down what seems to be necessary.