by bananicorn · 5y ago · 0 comments
Try this:
set backupdir=~/.vim/backups,.
set directory=~/.vim/swapfiles,.
It will only write in the current directory, if ~/.vim/backups does not exist, and the dot is just there for portability, so nothing breaks when using my vimrc on a new system.Edit: Upon actually reading your blog-post, I understand at least one reason - my options may not change the behaviour of a file not being written to the correct inode, so you have a point for some build systems.
I actually learned rather much reading this, thank you for sharing!
set directory=~/.vim/swapfiles//,.
From the help text for "directory":> For Unix and Win32, if a directory ends in two path separators "//", the swap file name will be built from the complete path to the file with all path separators replaced by percent '%' signs (including the colon following the drive letter on Win32). This will ensure file name uniqueness in the preserve directory.
Edit: Hmmm. I’ll have to think some more about it. Anyway, glad you found my witeup useful.