如何让VIM维护文件的创建日期?(OS X)


1

因此,每当我在OS X上的VIM中保存文件时,它似乎都会覆盖整个内容而不是更新它。

如果我运行,ls -tU我可以看到创建日期更改,它确实更新到GUI上的最后修改。(OS X与其他UNIX变体不同,它确实维护文件创建日期)

这是一个快速解决方案吗?

Answers:


2

:help 'backupcopy' 说:

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

看起来只是设置'backupcopy'为“是”应该让你得到你想要的东西。即把它放在你的.vimrc中:

set backupcopy=yes
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.