Xuyuanp/nerdtree-git-plugin — pull request #8 by scrooloose (2014-11-20 20:07:02+00:00)
Title: use buffer level vars to allow many git-enabled nerdtrees to exist

Currently we have these global variables (or script level, which has the
same effect):
g:NERDTreeCachedGitFileStatus
g:NERDTreeCachedGitDirtyDir
s:NOT_A_GIT_REPOSITORY

The global nature can cause a bug when many nerdtrees exist. For
example open vim and:

1. `:e /dir/with/git/repo`
2. `:sp /another/dir/with/git/repo`

The git cache (held in the 3 vars above) will be set to one of the 2
nerdtrees - so when you move the cursor into the other tree and refresh,
the git cache will be wrong until it expires. This has the visual effect
of stripping all git flags from the tree.

This patch changes the vars to be buffer vars instead - which fixes this
bug.

Note: when the nerdtree sends us the refresh event, the cursor is always
in the nerdtree buffer, so using buffer vars should be safe.