So whenever I save a file in VIM on OS X, it seems to overwrite the entire thing instead of updating it.

If I run ls -tU I can see that the creation date changes and it does indeed update to the last modified on the GUI. (OS X unlike other UNIX variants does maintain a file creation date)

Is there a quick fix for this?


:help 'backupcopy' says:

                        *'backupcopy'* *'bkc'*
'backupcopy' 'bkc'  string  (Vi default for Unix: "yes", otherwise: "auto")
            {not in Vi}
    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

It looks like just setting 'backupcopy' to "yes" should get you what you're after. I.e. put this in your .vimrc:

set backupcopy=yes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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