Created
August 22, 2012 14:13
-
-
Save cluke009/3426023 to your computer and use it in GitHub Desktop.
Sublime Text 2 plugin that converts file to unix line endings and tabs to space on save
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime, sublime_plugin | |
# http://www.butlerpc.net/blog/2012/07/sublime-text-2-plugin-to-convert-tabs-to-spaces-on-save/ | |
# tabs to spaces | |
# https://github.com/SublimeText/LineEndings/blob/master/LineEndings.py | |
# for line ending conversion code | |
class ConvertTabsToSpaces(sublime_plugin.EventListener): | |
def on_pre_save(self, view): | |
edit = view.begin_edit() | |
view.run_command('expand_tabs', {"set_translate_tabs": True}) | |
view.run_command('set_line_ending', {"type":"unix"}) | |
view.end_edit(edit) | |
#sublime.message_dialog("Converted endings.") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment