@vimStatesByEditor = new WeakMap
@disposables.add atom.workspace.observeTextEditors (editor) =>
- return if editor.isMini() or @vimStatesByEditor.get(editor)
+ return if editor.isMini() or @getEditorState(editor)
vimState = new VimState(
atom.views.getView(editor),
@vimStatesByEditor.set(editor, vimState)
vimState.onDidDestroy => @vimStates.delete(vimState)
+ @disposables.add atom.workspace.onDidChangeActivePaneItem @updateToPaneItem.bind(this)
+
@disposables.add new Disposable =>
@vimStates.forEach (vimState) -> vimState.destroy()
@disposables.add new Disposable =>
@statusBarManager.detach()
+ updateToPaneItem: (item) ->
+ vimState = @getEditorState(item) if item?
+ if vimState?
+ vimState.updateStatusBar()
+ else
+ @statusBarManager.hide()
+
provideVimMode: ->
getGlobalState: @getGlobalState.bind(this)
getEditorState: @getEditorState.bind(this)