Take the tour ×  As part of the program I wrote, I constantly
read and write data from files. I noticed that as part of doing
so, I am inadvertently creating swap .swp files.  What do you
think is going on? What would cause swap files to appear if you
had to reproduce the problem?  share|improve this question add
comment  3 Answers  up vote 12 down vote accepted  The .swp file
is not a swap file in the OS sense. It is a state file. It keeps
your changes since the last save (except the last 200
characters), buffers that you have saved, unsaved macros and the
undo structure.  You can read more in VIM's help: vim +help\
swap-file. If there is a crash (power failure, OS crash, etc.),
then you can recover your changes using this swap-file. After
saving the changes from the swap file to the original file, you
will need to exit vim and remove the swap file yourself.
share|improve this answer add comment  .swp files are created by
Vim, they should be automatically deleted when you close the
file and exit the editor.