Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've just moved to Mac and am trying out TextMate, so I'm not familiar with bundle config etc. Is there a way to make TextMate just use spaces, rather than soft tabs, for all file types?

For example: I type 5 spaces. I want to then be able to go back three spaces and insert more characters, so I have [two spaces][text][three spaces]. What happens instead is that I hit the left arrow twice and end up back at the start of the line; even though there are no tab characters in the underlying file, TextMate it treating the first 4 spaces as a logical tab. I want to turn that off, globally.

share|improve this question
up vote 3 down vote accepted

My first answer doesn't exactly solve your problem but perhaps you could consider it. You can turn down the soft tab spacing to 2 spaces to be able to do what you mentioned in that example. Unless you have a very complicated spacing scheme, I find that 2 spaces gives the best compromise between nicely indented code and control over text placement. This setting would hold for each other language that you don't manually set the soft tabs for.

TextMate with Soft Tab size 2

If you really want no soft tabs at all, the method would be to set a soft tab size of 1, which is not possible in the TextMate GUI. This can be done by modifying the TextMate plist file at the Terminal. You'll need to set that for each language separately. As an example, for Perl:

defaults write com.macromates.textmate OakTextViewScopedTabSize -dict-add 'source.perl' '{ tabSize = 1; }'

Replace source.perl with whatever language you want to use; tabSize = 1 refers to the soft tab size. If it's for plain text, replace source.perl with text.plain. Looking at the com.macromates.textmate plist file, there also seem to be the entries text.catch-all and source.catch-all which I would assume would work for everything that hasn't already been specified. But it didn't seem that way when I tested.

share|improve this answer
Looks cracking. I'll have a go at that this evening, cheers. – Andy Jan 10 '10 at 12:42

to enable SOFT TABS

defaults write com.macromates.textmate OakTextViewScopedSoftTabs -dict-add 'source.perl' '{ softTabs = 1; }'

you can list all existent:

defaults read com.macromates.textmate OakTextViewScopedSoftTabs

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .