Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Aug 22, 2012
1 parent 8dfe1ff commit 95affba
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions EditorConfig.py
Expand Up @@ -3,9 +3,9 @@


LINE_ENDINGS = {
'lf': 'Unix',
'crlf': 'Windows',
'cr': 'CR'
'lf': 'unix',
'crlf': 'windows',
'cr': 'cr'
}


Expand All @@ -24,28 +24,19 @@ def on_load(self, view):

def apply_config(self, view, config):
settings = view.settings()
#window = view.window()
end_of_line = config.get('end_of_line')
indent_style = config.get('indent_style')
indent_size = config.get('indent_size')
end_of_line = config.get('end_of_line')
trim_trailing_whitespace = config.get('trim_trailing_whitespace')
# Indent type
if indent_style == 'space':
settings.set('translate_tabs_to_spaces', True)
elif indent_style == 'tab':
settings.set('translate_tabs_to_spaces', False)
# Converting of current code is disabled because of Sublime bug: http://j.mp/KSQjOA
#if indent_style == 'tab':
#window.run_command('unexpand_tabs', {'set_translate_tabs': True})
#if indent_style == 'space':
#window.run_command('expand_tabs', {'set_translate_tabs': True})
# Indent size
if indent_size:
try:
settings.set('tab_size', int(indent_size))
except ValueError:
pass
# EOL
if end_of_line in LINE_ENDINGS:
view.set_line_endings(LINE_ENDINGS[end_of_line])
if trim_trailing_whitespace == 'true':
Expand Down

0 comments on commit 95affba

Please sign in to comment.