Writing a file with vim doesn't fire a file change event on OS X
I am using watchdog to monitor .less file change events on OS X. If I 开发者_如何学运维change the contents of a .less file with TextMate or Sublime Text the modification event is captured. However, if I edit the content with vim no file modification event is fired (but file creation events for files created with vim are captured). I have seen the same behaviour with FSEvents and kqueue (both of which I have practically zero knowledge of).
I wonder can anybody explain this behaviour?
On Watchdog's readme there is a section specifically targeting the problem you describe: About using watchdog with editors like Vim. It is suggested to use set noswapfile
in your ~/.vimrc
.
Vim normally does not create a temporary file and then rename it. This is so that filesystem aspects such as links (both soft and hard) are preserved when writing files. This is discussed briefly in the Writing section of the Vim documentation, with further information in the 'backupcopy'
option documentation.
Your file change events might be limited to changing directory entries.
精彩评论