6

I'm using gVIM on Windows.

Everytime I edit text file and save it, VIM makes a file with '~(tilde)' in extention - like this : 'crappycode.txt~'

It's so annoying that I have to delete it manually.

Is there any option that stops gVIM to make such file?

p.s. sorry for bad english.

2 Answers 2

6

This sounds like a temporary file being created by vim. Just add the following to your .vimrc

set nobackup
4
  • 1
    They are not temporary but backups of the original file - that's the reason nobackup turns them off. Nov 6, 2013 at 0:37
  • You should add set nowritebackup and set noswapfile as well. Nov 6, 2013 at 20:14
  • 3
    NO. Do NOT set nowritebackup and noswapfile. These files are deleted automatically by Vim when they are no longer needed. They will ONLY get left behind if something goes wrong, and you can then use them to recover then. The writebackup file contains the old file content until Vim successfully writes ALL the new file content, then gets deleted. The swap file gets deleted whenever Vim exits correctly without a crash or force-kill. If you edit the file again and the swap file exists, Vim prompts you for file recovery. If you edit a file in multiple Vims, the swap file lets you detect that.
    – Ben
    Nov 10, 2013 at 4:38
  • this does not work on my win 10
    – Drako
    Aug 2, 2018 at 6:29
1

(Not enough point to comment)

Here is a more complete answer on Stack Overflow

https://stackoverflow.com/questions/607435/why-does-vim-save-files-with-a-extension

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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