Monday, November 20, 2006

vim file backup location on windows

I use vim on windows. When I open a save a file with vim, it always creates a backup file with tilda (~) appended to the file name in same folder. Now this looks plain ugly and second thing is, I want to centralize my vim backup location. You need to overwrite the default behavior of your vim editor.
 my _vimrc is sourced from these 2 files
  • source $VIMRUNTIME/vimrc_example.vim
  • source $VIMRUNTIME/mswin.vim
So I just go ahead and put the following two lines in my vimrc_example.vim file. End of all problems and happy vimming ;o)

if has("vms")
 set nobackup " do not keep a backup file, use versions instead
else
 set backupdir=c:\logs\vim
 set backup " keep a backup file
endif
 
© Life of a third world developer
Maira Gall