pivotal/vim-config — pull request #9 by joemoore (2012-07-16 19:48:14+00:00)
Title: Add optional Vim autosaving support when running in tmux

This allows Vim running within tmux to approximate the autosaving behavior of MacVim.

These optional libraries, used in conjunction with tmux, causes all Vim buffers running within tmux panes to write.
The write occurs just before any terminal command is executed within tmux. In a nutshell when within tmux:

$ ls #=> is really "tell all Vims to write, then run `ls`
$ echo "autosaving is cool" # => tell all Vims to write, then run `echo "autosaving is cool"`
$ # => tell all Vims to write, then run

Note that the autosave occurs when termal commands are executed, not when Vim or the terminal "lose focus." For example, an autosave will *not* occur when switching from an un-written buffer in Vim to a web browser.

This solution was developed by Casecommons and extracted from their public repositories.