问题
I am using Vim on Windows and decided to create a separate directory for all my backup files created by vim.
I am using Vim from my command prompt and not using the vim GUI(gVim).
I looked at this post and added the following lines in my _vimrc
set backup
set backupdir = D:\\VimTemp
I have already created D:\VimTemp on my system.
Now whenever I try to save changes to my file using :w I get the following error message
"PenProperties.py" E510: Can't make backup file (add ! to override)
I have already tried setting the backupdir in the following ways:
- set backupdir = D:\\VimTemp 
- set backupdir = "D:\\VimTemp" 
- set backupdir = "D:\\VimTemp\\" 
- set backupdir = "D:\VimTemp" 
Now, I have already looked at similar questions on stackoverflow but the problem is still there.
So, my question is how to make this work properly.
回答1:
Kill the spaces around =
set backupdir=D:\\VimTemp
should work if you've created the directory.
回答2:
On Linux, you can do by setting in editor- :verbose set backupdir?
来源:https://stackoverflow.com/questions/10664805/vim-error-e510-cant-make-backup-file-add-to-override