]> git.r.bdr.sh - rbdr/dotfiles/blobdiff - atom/packages/vim-mode/lib/vim-mode.coffee
Fixes submodule names for paths
[rbdr/dotfiles] / atom / packages / vim-mode / lib / vim-mode.coffee
index 660fba0cc8e13901e0a650dc0991d5e32ffdd724..b8ef936f2bba75cb3c819db138c6743e8558cc58 100644 (file)
@@ -16,7 +16,7 @@ module.exports =
     @vimStatesByEditor = new WeakMap
 
     @disposables.add atom.workspace.observeTextEditors (editor) =>
     @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),
 
       vimState = new VimState(
         atom.views.getView(editor),
@@ -28,6 +28,8 @@ module.exports =
       @vimStatesByEditor.set(editor, vimState)
       vimState.onDidDestroy => @vimStates.delete(vimState)
 
       @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 =>
       @vimStates.forEach (vimState) -> vimState.destroy()
 
@@ -46,6 +48,13 @@ module.exports =
     @disposables.add new Disposable =>
       @statusBarManager.detach()
 
     @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)
   provideVimMode: ->
     getGlobalState: @getGlobalState.bind(this)
     getEditorState: @getEditorState.bind(this)