I'm trying to understand and eventually fix the following behavior: when I save a file using VIM, it triggers the
write event twice.
I'm using Ubuntu 16.10, and I created an empty
.vimrc file to make sure that no plugins create this behavior.
So, I open the
vim -u .vimrc foo.txt
And then using
inotify-tools (installed using
sudo apt install inotify-tools) I run the following command:
inotifywait -m foo.txt
Then in VIM I do
:w, triggering the save. I can see the following output:
$ inotifywait -m foo.txt Setting up watches. Watches established. foo.txt OPEN foo.txt ACCESS foo.txt CLOSE_NOWRITE,CLOSE foo.txt MODIFY foo.txt OPEN foo.txt MODIFY foo.txt CLOSE_WRITE,CLOSE foo.txt ATTRIB
backupcopy=yes I can see EXACTLY the same behavior. I tried to add it in the
vimrc and restart VIM, but there was no change at all.
How can I fix this?
Everyone on the internet recommends using
backupcopy=yes which for some reason doesn't fix the issue on my machine. Why?
Is there any other workaround?
In my original
~/.vimrc I do have this at the end of the file:
" Node.js fs.watch set backupdir=~/.vim/tmp,. set directory=~/.vim/tmp,. set backupcopy=yes
Doesn't seem to make any change (I do have the