Why is it when I create/save my file (say, filename is 'xyz.sql'), gvim saves another file which it calls 'xyz.sql~' in the same directory? Can I delete this "extra" files or are they needed for some reason? Even when I close gvim, they are still present.

link|improve this question

feedback

2 Answers

up vote 2 down vote accepted

See the vim FAQ Section 7:

You have set the 'backup' option, so Vim creates a backup file when saving
the original file. You can stop Vim from creating the backup file, by
clearing the option:

    :set nobackup
link|improve this answer
feedback

As another answer correctly says, these are backup files. I wanted to just add that if you want to still have backup files, but don't want them to clutter your directories, you can use the backupdir option:

set backupdir=~/.backups,.

From the vim help:

List of directories for the backup file, separated with commas.

  • The backup file will be created in the first directory in the list where this is possible. The directory must exist, Vim will not create it for you.
  • Empty means that no backup file will be created ('patchmode' is impossible!). Writing may fail because of this.
link|improve this answer
that's a good feature as well, thanks @Jan Hlavacek – drapkin11 Mar 3 '11 at 16:04
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.