2

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.

2 Answers 2

3

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
1

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.
1
  • that's a good feature as well, thanks @Jan Hlavacek
    – drapkin11
    Commented Mar 3, 2011 at 16:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .