It depends on what the file editing application does. In this case, it seems your editor’s behavior when saving the file is to delete the old file and write the new content as a new file with the same name. From the point of view of inotify, this is exactly what happens, so it fires a delete event, and then a create event. Inotify cannot know that the file that was deleted and the file that was created in its place are logically connected.
source
share