Shashi Kumar wrote:
How can I disable automatic setting of the "modified flag" or auto save option?
I have set some option with which I think VIM is automatically saving the file
thus changing the timestamp of the file. This poses a problem when I open
header files especially when the target I need to build has a lot of source
files. The problem occurs even when I open the file using gview.
I use VIM on Windows XP and my _vimrc and _gvimrc are attached.
Thanks in advance
Shashi Kumar
I don't notice anything obvious in the scripts attached. If it is not in
other plugins you use, then maybe you modify and save your files
manually? Whenever Vim saves a file, the disk file gets the current date
& time as "modification date". This is intentional, and noticing
modification dates is intentionally what Make does: if a source file has
been modified, and is thus "newer" than the corresponding object, then
of course that source file must be recompiled; otherwise your
modifications won't do it into the binary.
If you change something in a file using Vim, then do the opposite change
without using undo, the 'modified' flag will stay on. To undo a change
_and_ clear the 'modified' flag, use the Normal-mode u command.
It is possible to make Vim "believe" that the file has not been modified
by means of
:setlocal nomodified
but, unless you know _exactly_ what you're doing, it will usually make
Vim think the file on disk is other than it really is, so it could quite
conceivably lead to loss of data if you forget to save.
To avoid making changes in a file, open it readonly using ":view" rather
than ":edit", ":sview" rather than ":new", etc. For an additional lock, use
:setlocal nomodifiable
-- then, just as with Help files, Vim will flatly refuse any change on
that file. You can even set that in a |modeline| but in that case, if
some day the file really does need a modification, you will have to
unlock it manually after opening it.
Best regards,
Tony.