Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've read that most editors will replace the file when you actually want to save changes to that file How to execute a command whenever a file changes?. So how does VIM behave?

share|improve this question
up vote 4 down vote accepted

it might depend on various settings related to 'backup', everything that has to keep a copy of the file as it was before the write happened. one of settings that controls that is: 'backupcopy':

When writing a file and a backup is made, this option tells how it's done. This is a comma separated list of words.

The main values are:

"yes"    make a copy of the file and overwrite the original one
"no"     rename the file and write a new one
"auto"   one of the previous, what works best

so, depending on your vimrc (backup set and backupcopy to no), vim might rename a file. when

share|improve this answer
Yeah this also complies with my observation that inotifywait printed the same inode number that has changed.. – math May 4 '12 at 11:46
comment on @math's comment: i changed the answer quite a bit after his comment. the former version stated that the test i did wrote into the same inode / file. but since my vimrc runs without backup ... not a valid test :) – akira May 4 '12 at 14:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .