this is original text https://dl.dropboxusercontent.com/u/9303546/SublimeText/bugs/SpacesToTabs.py
this is what this forums shows:
import re, sublime, sublime_plugin
class SpaceToTabsListener(sublime_plugin.EventListener):
def on_post_text_command(self, view, command_name, args):
if command_name == 'insert' and args['characters'] == '\n' and not view.settings().get('translate_tabs_to_spaces'):
view.run_command('unexpand_tabs', {"set_translate_tabs":True})
view.run_command('space_to_tabs')
class SpaceToTabsCommand(sublime_plugin.TextCommand):
def run(self, edit):
view = self.view
for region in reversed(view.sel()):
indentation = sublime.Region(view.line(region).begin(), region.end())
content = view.substr(indentation)
if re.search('^\t+ +', content):
view.replace(edit, indentation, re.sub('^(\t+)( +)', '\\1\t', content))