I normally setup my backup directory in my vimrc as follows.
set backupdir=~/vimtmp,/tmp,.
set directory=~/vimtmp,/tmp,.
This works as all the *.*~
goes to the vimtmp
folder.
However, certain plugins such as NERDTree, Tagbar
create their temporary files in my current working directory. For instance, following files are created when these plugins are started.
[[buffergator-buffers]]
__Tagbar__
NERD_tree_3
This is really annoying issue because when I work with a version control system, these files are being created in some folders and I sometimes push them to the central repo accidentally.
Could you please suggest me some tips to handle this problem? For instance, how can I set current working directory specifically for the plugins so that they will use that directory for their temporary files.
Thank you very much.
After reviewing my own vimrc file, I found that following auto command is causing the problem. I was using this command to automatically save a file when I have created it. However, the side effect of this command was that it saves all buffers (even NERDTree, TagBar etc.) as well. Therefore, it was cluttering my working directory. So, by disabling the following command, I solved the problem.
" evil command
" autocmd BufNewFile * :write