       view = new QuickHighlightView(editor, options)
       @viewByEditor.set(editor, view)
 
-  toggle: (editor, keyword) ->
+  toggle: (keyword) ->
+    editor = atom.workspace.getActiveTextEditor()
     keyword ?= editor.getSelectedText() or @getCursorWord(editor)
-    @editorSubscription ?= @observeTextEditors()
+    @initQuickHighlightIfNeeded()
     @keywordManager.toggle(keyword)
 
   onDidChangeHighlight: (fn) ->

    @subscriptions = new CompositeDisposable
    @emitter = new Emitter
    @viewByEditor = new Map
    toggle = @toggle.bind(this)
    @subscriptions.add atom.commands.add 'atom-text-editor:not([mini])',
      'quick-highlight:toggle': -> toggle(@getModel())
      'quick-highlight:clear': => @keywordManager?.clear()

    if atom.config.get('quick-highlight.highlightSelection')
      @editorSubscription = @observeTextEditors()

  deactivate: ->
    @keywordManager?.destroy()
    @viewByEditor.forEach (view) -> view.destroy()
    @subscriptions.dispose()
    @editorSubscription?.dispose()
    @statusBarManager.detach()
    [@keywordManager, @subscriptions] = []

  getCursorWord: (editor) ->
    selection = editor.getLastSelection()

    selection.cursor.setBufferPosition(cursorPosition)
    word

  initQuickHighlightIfNeeded: ->
    return if @editorSubscription?

    QuickHighlightView = require './quick-highlight-view'
    KeywordManager = require './keyword-manager'
    StatusBarManager = require './status-bar-manager'

    @keywordManager = new KeywordManager
    @statusBarManager = new StatusBarManager
