   consumeVim: ({getEditorState, observeVimStates}) ->
     @subscriptions.add observeVimStates (vimState) =>
       {editor} = vimState
-      return unless @isNarrowEditor(editor) and ui = @getUiForEditor(editor)
-
-      if settings.get('vmpAutoChangeModeInUI')
-        ui.autoChangeModeForVimState(vimState)
+      if settings.get('vmpAutoChangeModeInUI') and @isNarrowEditor(editor)
+        @getUiForEditor(editor)?.autoChangeModeForVimState(vimState)
 
     confirmSearch = -> # return search text
       editor = atom.workspace.getActiveTextEditor()

        @currentNarrowEditor = item

    @subscriptions.add atom.commands.add 'atom-text-editor',
      'narrow:lines': => @narrow('lines')
      'narrow:lines-by-current-word': => @narrow('lines', uiInput: @getCurrentWord())

      'narrow:fold': => @narrow('fold')
      'narrow:fold-by-current-word': => @narrow('fold', uiInput: @getCurrentWord())

      'narrow:symbols': => @narrow('symbols')
      'narrow:git-diff': => @narrow('git-diff')
      'narrow:bookmarks': => @narrow('bookmarks')

      'narrow:search': => @narrow('search')
      'narrow:search-by-current-word': => @narrow('search', currentWord: true)



      'narrow:atom-scan': => @narrow('atom-scan')
      'narrow:atom-scan-by-current-word': => @narrow('atom-scan', currentWord: true)

  getUi: ->
    @getUiForEditor(@currentNarrowEditor)
