title: Sublime Text 3 Plugin changing run to on_pre_save
body: <p>I have been working on a Sublime Text 3 plugin that fixes some coding standards I have at work(That I have a bad habit of missing) I currently have this working with a command run in the console. <a href="https://forum.sublimetext.com/t/find-and-replace-py/8761" rel="nofollow">Most of the code was originally from this thread.</a></p>
  
  <pre><code>import sublime, sublime_plugin
  
  class ReplaceCommand(sublime_plugin.TextCommand):
      def run(self, edit):
          #for each selected region
          region = sublime.Region(0, self.view.size())
          #if there is slected text
          if not region.empty():
              #get the selected region
              s = self.view.substr(region)
  
              #perform the replacements
              s = s.replace('){', ') {')
              s = s.replace('}else', '} else')
              s = s.replace('else{', 'else {')
  
              #send the updated string back to the selection
              self.view.replace(edit, region, s)
  </code></pre>
  
  <p>Then you just need to run:</p>
  
  <pre><code>view.run_command('replace')
  </code></pre>
  
  <p>And it will apply the coding standards(there are more I plan to implement but for now i'll stick with these) I would like this to run on save. </p>
  
  <p>I tried just changing run(self, edit) to on_pre_save(self, edit) but it does not work. I don't get any syntax errors but It just doesn't work. </p>
  
  <p>Can anyone tell me how to make this run on save instead of having to run the command?</p>