On Windows, I normally work with Total Commander, which can easily be configured to ignore these *.*~ and *~ completely. But occasionally when I switch to Windows Explorer, I get little bit confused with all that “unknown” files/.
Can I set up Vim so that for every backup it creates it will also set “hidden” attribute?
Or set up some nice workaround?
I know I can set up Vim to put these in other directory, but I’d like to avoid that, since IIUC, it could suffer from naming conflicts.
If the
backupoption is set,vimupdates the backup file every time we write the file with:w. And every time, it creates a file which is not hidden even though you had forcibly hidden it previously! So we need to do something everytime we write the buffer into file.You can do this on windows. In your
_vimrcfile ( generally found atC:\Program Files (x86)\Vim), add this lineWhere,
This will make sure that the backup file gets hidden with every write to file from buffer. Why every time? Cos
vimcreates a non-hidden file at every write!But you have to live with a flashing black window ( command window where we are running
attribcommand ) every time you save your file, but worth the pain 🙂On linux/unix systems you can add this in your
.vimrcHope this helps all those trying to find how to hide vim backup files.