vim - How to stop vim creating "tilde" backup files

Vim, aka the Programmer's Editor, by default creates backup files (ends with a tilde character) whenever editing file. E.g. myfile~, another_file~, yet_another_file~ and etc.

After some time, this generates too many backup laying around the file system. Too messy. This is how to stop vim create these backup files :

In ~/.vimrc, include the below options :

set nobackup
set nowritebackup
*** do check the vim configuration file (~/.vimrc) that no other occurrence of "set backup" or this won't work

Another better way, create the backup files in a particular directory :
set backupdir=~/.vim/backup

*** make sure the directory "~/.vim/backup" exist or else, vim will complain every time it starts.

Ciao !!!

No comments: