0

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.

Validus Oculus
  • 2,756
  • 1
  • 25
  • 34
  • No, those files are not created by those plugins. You or one of your other semi-useless plugins do that. – romainl Dec 06 '15 at 09:23
  • I delete those files, then open vim, then open tagbar and `__TagBar__` file is created. Now, what do you mean by semi-useless plugins create those files? – Validus Oculus Dec 06 '15 at 09:25
  • 1
    The three plugins never create files, temporary or not. One of your other plugins, or some command somewhere in your config is going through your windows and creates those files for some unknown reason. – romainl Dec 06 '15 at 10:02
  • Ok, understood now, let me to check it. – Validus Oculus Dec 06 '15 at 10:30
  • `autocmd BufNewFile * :write` with yout hint, I found this evil command in my vimrc :) thanks man. – Validus Oculus Dec 06 '15 at 10:39
  • If you have solved your own problem, you should consider putting the solution into an answer to your own question. After a couple of days, the system will allow you to also mark your own answer as accepted. – Dan Lowe Dec 06 '15 at 17:11

1 Answers1

0

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
Validus Oculus
  • 2,756
  • 1
  • 25
  • 34