What is the purpose of the X~ files? And if its unnecessary, is there a way to prevent Vim from creating one?
This is a backup file that contains a copy of the previous revision of the file.
You can change this behavior by adding a line to the end of your .vimrc file:
set nobackup
its a backup file, every time you save while modifying something it will create one. There's an option to turn it off.
Turn it off using
:se nobackup
You can also tell it to put the backup file in a different location by using:
:se directory=c:\temp
They are backup files. Maybe :set nowritebackup
will turn off this feature.
Vim is creating backup files automatically. To turn it off you have to add the following line to your .vimrc config file:
set nobackup
What I personally do is that I create a folder $HOME/.vim/backupfiles
that will contain all my backup files, instead of leaving them all scattered around.
My .vimrc
contains the following:
set backupdir=~/.vim/backupfiles,~/tmp,.
This way you have the protection of backup files but avoid the littering of your folders with *~
files.