 {CompositeDisposable} = require 'atom'
+
+String::replaceAll = (search, replacement) ->
+  # Kudos http://stackoverflow.com/a/17606289
+  #
+  target = this
+  target.replace new RegExp(search, 'g'), replacement
 
 module.exports = EditInNewTab =
   config:


          atom.workspace.observeTextEditors (editor) ->
            # makes sure tabs don't get mixed up
            return unless editor.id is childEditor.id

            childEditor.onDidChange ->


  activate: (state) ->
    # Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable
    #
    @subscriptions = new CompositeDisposable

    # Register commands
    #
    @subscriptions.add atom.commands.add 'atom-workspace', 'edit-in-new-tab:copy-selection': => @editInNewTab(false)
    @subscriptions.add atom.commands.add 'atom-workspace', 'edit-in-new-tab:move-selection': => @editInNewTab(true)
    @subscriptions.add atom.commands.add 'atom-workspace', 'edit-in-new-tab:settings': => @openSettings()
