Hi Mohsin,

On 6/6/07, Mohsin <[EMAIL PROTECTED]> wrote:
I usually do search like this:

$ grep  Word *.* | vim -u myvimrc -

$ cat myvimrc

   :autocmd StdinReadPost * :sav! /tmp/x

but when I quit :q, vim always asks me to save the file again,
why is the file marked as modified?

I tried all combinations of flags, but can't get vim to
mark the file as "saved",

It's a bug. Here is the patch. Please test it carefully, thanks very
much for reporting this to me. I'll ask Bram to add it to the official
release soon.

Index: buffer.c
===================================================================
--- buffer.c    (revision 296)
+++ buffer.c    (working copy)
@@ -171,14 +171,6 @@
           /* Put the cursor on the first line. */
           curwin->w_cursor.lnum = 1;
           curwin->w_cursor.col = 0;
-#ifdef FEAT_AUTOCMD
-# ifdef FEAT_EVAL
-           apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
-                                                       curbuf, &retval);
-# else
-           apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf);
-# endif
-#endif
       }
    }

@@ -207,6 +199,18 @@
       unchanged(curbuf, FALSE);
    save_file_ff(curbuf);              /* keep this fileformat */

+#ifdef FEAT_AUTOCMD
+    if (read_stdin)
+    {
+# ifdef FEAT_EVAL
+        apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
+                                                       curbuf, &retval);
+# else
+        apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf);
+# endif
+    }
+#endif
+
    /* require "!" to overwrite the file, because it wasn't read completely */
#ifdef FEAT_EVAL
    if (aborting())


any insights appreciated,
mosh.


Regards,

Edward L. Fox

Reply via email to