       @modifiedSubscription = dispose: =>
         @item.off?('modified-status-changed', modifiedHandler)
 
+    itemSavedHandler = (event) =>
+      if @path isnt event.path
+        @path = event.path
+        @setupVcsStatus()
+
+    @savedSubscription = @item.buffer.onDidSave(itemSavedHandler)
+
     @configSubscription = atom.config.observe 'tabs.showIcons', =>
       @updateIconVisibility()
 

      @classList.remove('modified') if @isModified
      @isModified = false

  # Subscribe to the project' repo for changes to the Git status of the file
  # on this tab.
  subscribeToRepo: (repo) ->
    return unless repo?

    @subscriptions.add repo.onDidChangeStatus (event) =>
      @updateStatus(repo) if @path is event.path
    @subscriptions.add repo.onDidChangeStatuses =>
      @updateStatus(repo)

  # Update the status property of this tab using the repo.
  updateStatus: (repo) ->
    return unless repo?

    newStatus = null

      @itemTitle.classList.remove('status-ignored', 'status-modified',  'status-added')
      @itemTitle.classList.add("status-#{@status}") if @status

module.exports = document.registerElement('tabs-tab', prototype: TabView.prototype, extends: 'li')
