     @subscriptions.add(bufferSavedSubscription)
     @subscriptions.add(editorDestroyedSubscription)
 
+  toggleMessage: (messagePrepend, enabled) ->
+    "Rubocop Auto Correct: "+ messagePrepend + " " +
+      (if enabled then "ON" else "OFF")
+
   toggleAutoRun: ->
-    if atom.config.get('rubocop-auto-correct.autoRun')
-      atom.config.set('rubocop-auto-correct.autoRun', false)
-      atom.notifications.addSuccess("Turn OFF, Auto Run")
-    else
-      atom.config.set('rubocop-auto-correct.autoRun', true)
-      atom.notifications.addSuccess("Turn ON, Auto Run")
+    setting = atom.config.get('rubocop-auto-correct.autoRun')
+    atom.config.set('rubocop-auto-correct.autoRun', !setting)
+    atom.notifications.addSuccess(@toggleMessage("Auto Run", !setting))
 
   toggleNotification: ->
-    if atom.config.get('rubocop-auto-correct.notification')
-      atom.config.set('rubocop-auto-correct.notification', false)
-      atom.notifications.addSuccess("Turn OFF, Notification")
-    else
-      atom.config.set('rubocop-auto-correct.notification', true)
-      atom.notifications.addSuccess("Turn ON, Notification")
+    setting = atom.config.get('rubocop-auto-correct.notification')
+    atom.config.set('rubocop-auto-correct.notification', !setting)
+    atom.notifications.addSuccess(@toggleMessage("Notifications", !setting))
 
   toggleCorrectFile: ->
-    if atom.config.get('rubocop-auto-correct.correctFile')
-      atom.config.set('rubocop-auto-correct.correctFile', false)
-      atom.notifications.addSuccess("Correct the buffer")
-    else
-      atom.config.set('rubocop-auto-correct.correctFile', true)
-      atom.notifications.addSuccess("Correct the file")
+    setting = atom.config.get('rubocop-auto-correct.correctFile')
+    atom.config.set('rubocop-auto-correct.correctFile', !setting)
+    atom.notifications.addSuccess(@toggleMessage("Correct File", !setting))
 
   toggleDebugMode: ->
-    if atom.config.get('rubocop-auto-correct.debugMode')
-      atom.config.set('rubocop-auto-correct.debugMode', false)
-      atom.notifications.addSuccess("Turn OFF, Debug Mode")
-    else
-      atom.config.set('rubocop-auto-correct.debugMode', true)
-      atom.notifications.addSuccess("Turn ON, Debug Mode")
+    setting = atom.config.get('rubocop-auto-correct.debugMode')
+    atom.config.set('rubocop-auto-correct.debugMode', !setting)
+    atom.notifications.addSuccess(@toggleMessage("Debug Mode", !setting))
 
   run: (editor) ->
-    unless editor.getGrammar().scopeName.match("ruby")
-      return atom.notifications.addError("Only use source.ruby")
-    if atom.config.get('rubocop-auto-correct.correctFile')
-      if editor.isModified()
-        editor.save()
-      @autoCorrectFile(editor.getPath())
-    else
-      @autoCorrectBuffer(editor.getBuffer())
+    if editor
+      unless editor.getGrammar().scopeName.match("ruby")
+        return atom.notifications.addError("Only use source.ruby")
+      if atom.config.get('rubocop-auto-correct.correctFile')
+        if editor.isModified()
+          editor.save()
+        @autoCorrectFile(editor.getPath())
+      else
+        @autoCorrectBuffer(editor.getBuffer())
 
   projectRootRubocopConfig: (filePath) ->
     [projectPath, relativePath] = atom.project.relativizePath(filePath)
-    rubocopConfigPath = projectPath+'/.rubocop.yml'
-    if (fs.existsSync(rubocopConfigPath))
-      ['--config', rubocopConfigPath]
+    projectConfigPath = projectPath + '/.rubocop.yml'
+    homeConfigPath = fs.getHomeDirectory() + '/.rubocop.yml'
+    if (fs.existsSync(projectConfigPath))
+      ['--config', projectConfigPath]
+    else if (fs.existsSync(homeConfigPath))
+      ['--config', homeConfigPath]
     else
       []
 

          ''' }
        )

      rubocop = spawnSync(command, args, options)

      if rubocop.stderr != ""
        console.error(rubocop.stderr) if debug
        atom.notifications.addError(rubocop.stderr) if notification

      if rubocop.stdout.match("corrected")
        buffer.setTextViaDiff(fs.readFileSync(tempFilePath, 'utf-8'))
        if notification || debug
          re = /^.+?(:[0-9]+:[0-9]+:.*$)/mg
          offenses = rubocop.stdout.match(re)
          offenses.map (offense) ->
            message = offense.replace(re, buffer.getBaseName() + "$1")
            console.log(message) if debug
            atom.notifications.addSuccess(message) if notification

  autoCorrectFile: (filePath)  ->
    commandWithArgs = atom.config.get('rubocop-auto-correct.rubocopCommandPath')

        @handleEvents(editor)

    @subscriptions.add atom.commands.add 'atom-workspace',
      'rubocop-auto-correct:current-file': => @run(atom.workspace.getActiveTextEditor())
      'rubocop-auto-correct:toggle-auto-run': => @toggleAutoRun()
      'rubocop-auto-correct:toggle-notification': => @toggleNotification()
      'rubocop-auto-correct:toggle-correct-file': => @toggleCorrectFile()
