Try adding:
set nobackup nowritebackup
to your vimrc.
UPDATE with regards to Jason Lefler's answer
If you want to prevent your backup/undo/swap files to be created next to your edited file consider setting directories for them:
let &directory = expand('~/.vimdata/swap//')
set backup
let &backupdir = expand('~/.vimdata/backup//')
set undofile
let &undodir = expand('~/.vimdata/undo//')
if !isdirectory(&undodir) | call mkdir(&undodir, "p") | endif
if !isdirectory(&backupdir) | call mkdir(&backupdir, "p") | endif
if !isdirectory(&directory) | call mkdir(&directory, "p") | endif
You set :h directory
, :h backupdir
, :h undodir
to whatever you prefer. Note, there is double slash //
at the end (~/.vimdata/swap//
) needed to prevent collisions when you edit the same file names in different paths, e.g., there will be files like C%%Users%%username%%docs%%test.adoc~
and C%%Users%%username%%docs%%awesome%%test.adoc~
created in backupdir
.
Then you create those directories if they don't exist. .vimdata
dir is what I use to have all of them in one place, you can change it of course.