       'autocomplete-plus:confirm': @confirmSelection,
       'autocomplete-plus:confirmIfNonDefault': @confirmSelectionIfNonDefault,
       'autocomplete-plus:cancel': @cancel
-    @subscriptions.add atom.config.observe 'autocomplete-plus.useCoreMovementCommands', => @bindToMovementCommands()
     @subscriptions.add(atom.config.observe('autocomplete-plus.enableExtendedUnicodeSupport', (enableExtendedUnicodeSupport) =>
       if enableExtendedUnicodeSupport
         @wordPrefixRegex = new RegExp("^[#{UnicodeLetters}\\d_-]")

    if marker = editor.getLastCursor()?.getMarker()
      @activeEditor = editor
      @overlayDecoration = editor.decorateMarker(marker, {type: 'overlay', item: this})
      @addKeyboardInteraction()

  hide: =>
    return if @activeEditor is null
    @destroyOverlay()
    @removeKeyboardInteraction()
    @activeEditor = null

  destroyOverlay: =>

      else
        keys['enter'] = 'autocomplete-plus:confirm'

    @bindings.add atom.keymaps.add(
      'atom-text-editor.autocomplete-active',
      {'atom-text-editor.autocomplete-active': keys})

    useCoreMovementCommands = atom.config.get('autocomplete-plus.useCoreMovementCommands')
    commandNamespace = if useCoreMovementCommands then 'core' else 'autocomplete-plus'

    commands = {}
    commands["#{commandNamespace}:move-up"] = (event) =>
      if @isActive() and @items?.length > 1
        @selectPrevious()
        event.stopImmediatePropagation()
    commands["#{commandNamespace}:move-down"] = (event) =>
      if @isActive() and @items?.length > 1
        @selectNext()
        event.stopImmediatePropagation()
    commands["#{commandNamespace}:page-up"] = (event) =>
      if @isActive() and @items?.length > 1
        @selectPageUp()
        event.stopImmediatePropagation()
    commands["#{commandNamespace}:page-down"] = (event) =>
      if @isActive() and @items?.length > 1
        @selectPageDown()
        event.stopImmediatePropagation()
    commands["#{commandNamespace}:move-to-top"] = (event) =>
      if @isActive() and @items?.length > 1
        @selectTop()
        event.stopImmediatePropagation()
    commands["#{commandNamespace}:move-to-bottom"] = (event) =>
      if @isActive() and @items?.length > 1
        @selectBottom()
        event.stopImmediatePropagation()

    @bindings.add atom.commands.add(
      atom.views.getView(editor), commands)

    @bindings.add(
      atom.config.onDidChange 'autocomplete-plus.useCoreMovementCommands', =>
        @addBindings(editor))

  ###
  Section: Event Triggers
