Loading ...
Sorry, an error occurred while loading the content.

16577Re: bug?: same file loaded multiple times

Expand Messages
  • Bram Moolenaar
    Dec 1 2:16 AM
    • 0 Attachment
      Scott Graham wrote:

      > I normally do :find file.c to open a file, and have the root of my C project
      > added to path. This works fine, and Vim loads a file like:
      > d:\proj\ps2\src\file.c
      > But, now, if I do a :grep and the output in the :cwindow looks like
      > \proj\ps2\src\file.c|100|: blah
      > and I hit tab on that line, I get a second buffer with the same file, but a
      > different copy. Now when I move between them I get "warning: buffer
      > changed", and I lose changes if I load/save the wrong one.

      I can guess that you are using the Win32 version.

      A different copy of the same file? That shouldn't happen. Please use
      1 CTRL-G to find out what long name is used for the buffer. I suspect them to
      be different. Perhaps it's the difference between "d:\proj" and "\proj"?

      I can't find a "buffer changed" message in Vim. What is the literal text of
      the message? Do you have 'autowrite' set perhaps?

      > Using vim60l still.. I don't think this was fixed in M or N though (?).

      Probably not.

      > Also, regarding :cwindow, is it possible to have it be "reparsed" (or
      > something) after the BufReadPost?

      You can write it to a file and use ":cfile" to have it handled like an error
      file. Note that the text in the window doesn't really matter, the line number
      is used as the error number.

      > If I do something like:
      > autocmd BufReadPost quickfix :g/Binary\ file.*matches/:.d
      > to delete binary file matches (or similarly to remove hits in 'tags', or
      > ...)
      > Now, when I tab on those lines, Vim jumps to what _was_ on that line before,
      > not what's listed now.

      Right. That doesn't work. Vim remembers more information about an error than
      what's displayed in the quickfix window. Thus it's not possible to change the
      errors by editing the text in the window.

      I can understand that you would want to change the error list by editing the
      quickfix window. But I don't see how this would work. Perhaps it would be
      possible to make a line empty and then issuing a command to delete it from the
      error list.

      A computer programmer is a device for turning requirements into
      undocumented features. It runs on cola, pizza and Dilbert cartoons.
      Bram Moolenaar

      /// Bram Moolenaar Bram@... http://www.moolenaar.net \\\
      \\\ Vim: http://www.vim.org ICCF Holland: http://iccf-holland.org ///
    • Show all 4 messages in this topic