3

I'm having a problem when writing to a file created by another user. When I try to do :w I get the error message E506: Can't write to backup file (add ! to override) and when I do :w! the file get's written but I still see this:

/share/home/file.txt" 161L, 9896C written
E207: Can't delete backup file

:se backup? returns nobackup. The privileges of thefile are -rwxrwxrwx

This happens in neovim NVIM v0.5.0-445-gca02db1f9. If I try it with an older nvim like NVIM v0.2.2 it writes without any error just using :w.

Edit: more settings:

backupcopy=auto
backupdir=.,~/.local/share/nvim/backup

set writebackup? seems empty

  • 2
    :h E207 and :set writebackup? – Matt Jun 3 at 10:59
  • :set writebackup? returns ` writebackup` I'm not sure what that means the variable is set to; is it unset? – Moberg Jun 9 at 12:57
  • @moberg This means that Vim creates a backup file while writing the the file. This backup file is deleted after the write was successful (as you have nobackup). This is a security feature described in :h E207. It seems you don't have the necessary permissions to delete the backup file. – Ralf Jun 11 at 7:21
  • set backupdir? returns backupdir=.,~/.local/share/nvim/backup Where can I find the backup file that you are referring to @Ralf? – Moberg Jun 11 at 9:46
  • 1
    @Moberg I don't know. On Linux there is a tool named strace that might help to understand what Vim is doing exactly. Something like strace -o trace nvim file. After exit check the file trace and search for unlink (= delete file). – Ralf Jun 13 at 4:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.