Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

up vote 3 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
1  
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.