Use event BufLeave instead of BufWinLeave to record screen state to avoid undefined b:NERDTree error

Use event BufLeave instead of BufWinLeave to record screen state. The BufWinLeave event also triggered when exiting(:qa), will cause an undefined b:NERDTree error.
fix a bug from recent refactoring RE some NERDTreeCWD
Merge pull request #356 from alvan/patch-2

Use event BufLeave instead of BufWinLeave to record screen state
allow plugins to override the default mappings