Vim error E510: Can't make backup file (add ! to override)

18,901

Kill the spaces around =

set backupdir=D:\\VimTemp

should work if you've created the directory.

Share:
18,901

Related videos on Youtube

RanRag
Author by

RanRag

I am an undergraduate student who has completed his B-Tech in Information & Communication Technology(ICT), INDIA. I am just a normal guy who has recently found interest in programming. Initially I was a big Java fan but now I am a Python enthusiast. Currently, exploring Android App Development.

Updated on September 15, 2022

Comments

  • RanRag
    RanRag over 1 year

    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.

  • pb2q
    pb2q almost 12 years
    also: don't neglect the help command for vim problems --> :help backupdir
  • RanRag
    RanRag almost 12 years
    Nice. It Worked. Thanks a lot man and yes from next time I will first look at vim help.
  • pb2q
    pb2q almost 10 years
    @SJMP what platform are you running gvim in? The above uses windows-specific path naming conventions, so if you're running under linux/OSX then you'll need to adjust the command to point to the actual directory that you're trying to use. Also note that the command assumes the existence of the directory VimTemp on the D drive: If you're in windows, have you created that directory?
  • Sagar Jain
    Sagar Jain almost 10 years
    I am running on Windows. I got it now. Thank you :-)
  • nurettin
    nurettin over 6 years
    My problem was that I used single slash character for paths.