My "Soft Tabs" setting in TextMate is not sticky. After I restart TextMate, I often have to set the option again for the same file. How can I make this setting the sticky default across all files?
8 Answers
For Textmate 1
After doing some research, I found that you can set TextMate 1 to default to using Soft tabs.
In the "Shell Variables" area of the Advanced preferences pane, add a new entry with the name TM_SOFT_TABS
and a value of YES
.
From that point on, TextMate should default to Soft tabs, though for at least one or two languages, I had to specify the number of tabs. After I did that, it seemed to stick for everything I did.

- 25,519
- 37
- 106
- 129

- 1,340
- 1
- 13
- 14
-
2in addition to this, you can find a list of textmate shell variables you can set: http://manual.macromates.com/en/environment_variables.html – hellatan Jun 25 '11 at 16:39
-
Have a look for TextMate2-Answers on this page. – Matthias May 09 '12 at 10:08
-
I had to remove the image from your post because ImageShack has deleted it and replaced it with advertising. See http://meta.stackexchange.com/q/263771/215468 for more information. If possible, it would be great for you to re-upload them. Thanks! – Undo Sep 22 '15 at 01:04
For Textmate 2
To set the options in TextMate 2 add following settings to your ~/.tm_properties file:
softWrap = true
tabSize = 4
softTabs = true
Check these links for more information:
FAQ: https://github.com/textmate/textmate/wiki/FAQ
Settings: http://wiki.macromates.com/Reference/Settings

- 11,784
- 5
- 34
- 79

- 687
- 9
- 8
4.11 Using Spaces Instead of Tabs
TextMate can use spaces instead of tab characters. This is done by clicking the “Tab Size” pop-up in the status bar and enabling Soft Tabs.
This setting will only affect the current language and all languages with a common root that do not have the option set yet. The same applies to the state of spell checking, soft wrap and the actual tab size.
When soft tabs are enabled, TextMate will for the most part act exactly as if you were using hard tabs but the document does indeed contain spaces.
Looks like Textmate sets it for the current language, but I think Textmate analyzes the files you open and adjust its settings to match the files. You can convert the tabs in your files to spaces and vice versa in the "Text" menu.

- 1
- 1

- 124,188
- 49
- 220
- 267
-
It is true that Textmate adjusts the softtabs settings per language. However the problem is, after I shut down Textmate and start again, that setting doesn't stick. I often have to set Soft Tabs again for the same language. – Kelvin Mar 27 '09 at 18:02
-
For me it sticks. Try to download the cutting edge version or check your permissions. (I don't know where TextMate stores this piece of information though…) – Georg Schölly Mar 28 '09 at 10:11
You don't need anything special. You just need to adjust your Python bundle.
Go into the 'bundle editor' and find Python. Open its caret, and scroll down and find the 'miscellaneous' preferences. It should read something like:
{ decreaseIndentPattern = '^\s*(elif|else|except|finally)\b.*:';
increaseIndentPattern = '^\s*(class|def|elif|else|except|finally|for|if|try|with|while)\b.*:\s*$';
shellVariables = (
{ name = 'TM_COMMENT_START';
value = '# ';
},
{ name = 'TM_LINE_TERMINATOR';
value = ':';
},
);
}
These are the environmental variables. What you want is the environmental variable TM_SOFT_TABS
to be set to 'YES'. Simple enough, Just insert a new assignment like so:
{ name = 'TM_SOFT_TABS';
value = 'YES';
},
...and voilà! Your tabs will be soft every time you use Textmate in Python mode.
For all the different enviornmental variables you can set, check out the manual here: http://manual.macromates.com/en/environment_variables.html

- 1,470
- 2
- 18
- 19
-
1This doesn't work for me, nor does adding TM_SOFT_TABS to preferences. I have tried restarting TextMate, but TAB continues to yield \t. I'm baffled. – neoneye Jul 04 '11 at 13:14
-
... in addition to @Ivan Sviatenko's answer
For Textmate 2, language specific softTabs default
edit ~/.tm_properties
, for example:
# Default editing configuration
#
tabSize = 2
softTabs = true
softWrap = true
# Defaults for c
#
[ source.c ]
softTabs = true
tabSize = 8
# Defaults for python
#
[ source.python ]
softTabs = true
tabSize = 4
- Create an alias icon for TextMate on the desktop.
- Drag the file to be opened to the icon.
- The file should now be opened in TextMate.
- Set the soft tab with the status bar options.
- Close TextMate.
- Repeat step 2 - 5 for each file type you want the soft tab settings to be remembered.
- Every time you want to open a file type with TextMate drag that file to that desktop icon.
- Do not open more than one file type at the same time, the second file type opened will get its soft tab settings erased.
This is the only way I've been able to get a consistant behavior on the soft tabs settings.

- 2,440
- 26
- 12
I found a popular TextMate plugin called "TabMate," which has solved this issue for me. While it requires me to add a tabline to every file, TextMate adjusts my tab settings to be whatever is described in the tabline.
Also, technically gs's answer above should work but for some reason it isn't working for me and I found no other way to set SoftTabs is the default setting for ALL languages forever.

- 965
- 2
- 10
- 13