vi is deleting edited file and replacing it with new one. That's why attributes are not preserved.
This is log of operations on the file.
$ mkdir test
$ touch test/file
$ inotifywait -m -r test
Setting up watches. Beware: since -r was given, this may take a while!
Watches established.
# vi is now running in another shell
test/ OPEN file
test/ CREATE .file.swp
test/ OPEN .file.swp
test/ CREATE .file.swpx
test/ OPEN .file.swpx
test/ CLOSE_WRITE,CLOSE .file.swpx
test/ DELETE .file.swpx
test/ CLOSE_WRITE,CLOSE .file.swp
test/ DELETE .file.swp
test/ CREATE .file.swp
test/ OPEN .file.swp
test/ MODIFY .file.swp
test/ ATTRIB .file.swp
test/ CLOSE_NOWRITE,CLOSE file
test/ OPEN file
test/ CLOSE_NOWRITE,CLOSE file
test/ MODIFY .file.swp
test/ CREATE 4913
test/ OPEN 4913
test/ ATTRIB 4913
test/ CLOSE_WRITE,CLOSE 4913
test/ DELETE 4913
test/ MOVED_FROM file # old file moved
test/ MOVED_TO file~
test/ CREATE file # new file created
test/ OPEN file
test/ MODIFY file
test/ CLOSE_WRITE,CLOSE file
test/ ATTRIB file
test/ ATTRIB file
test/ MODIFY .file.swp
test/ DELETE file~
test/ CLOSE_WRITE,CLOSE .file.swp
test/ DELETE .file.swp
See this answer to disable that behaviour.