Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
add comment

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
share|improve this answer
add comment

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.
share|improve this answer
    
that's a good feature as well, thanks @Jan Hlavacek –  drapkin11 Mar 3 '11 at 16:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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