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

Re: Arg. list processing bug

Expand Messages
  • Bram Moolenaar
    ... Do :args , it s there. ... The first one that s found. All the names in the argument list are added to the buffer list. But a file can only be in the
    Message 1 of 3 , Apr 12, 2000
    • 0 Attachment
      Neil Bird wrote:

      > I've convinced myself that this is a bug. Try this (UNIX):
      >
      > # echo one > test1
      > # echo two > test2
      > # ln -s test2 test
      > # ls
      > test1 test2 test@
      > # vim test*
      > 3 files to edit
      > :ls
      > 1 % "test" line 1
      > 2 - "test1" line 0
      > Press RETURN or enter command to continue
      >
      > So, erm, where's test2?

      Do ":args", it's there.

      > At a guess, vim has somehow deduced that test and test2 are the 'same'
      > file, but has oddly plumped for the symlink, not the real one. Or is it
      > just going for the first one it came across?

      The first one that's found. All the names in the argument list are added to
      the buffer list. But a file can only be in the buffer list once. The check
      is done on device and inode number, thus symlinks are catched.

      > (if you :n from "test", you get "test1", then "test" again [not test2],
      > then the no-more error). A :bd on "test" first fixes it)

      The ":next" command goes through the argument list. Since "test2" is really
      the same as "test", that's the buffer you will use.

      > I'm not sure about this now. It's certainly not what I'd expect (esp.
      > when I really wanted to edit test1 & test2, skipping test, but test* was
      > easier to type!).

      The shell expands "test*" to "test test1 test2", so that's the arguments you
      get inside Vim. It just does what you told it to do...

      What could be changed is using the name of the actual file, not the first name
      that was found. In this situation that would work. But when you do an ":e
      test2" after ":e test", the name of the buffer would be changed. I'm not sure
      if that doesn't have annoying side effects.

      --
      hundred-and-one symptoms of being an internet addict:
      6. You refuse to go to a vacation spot with no electricity and no phone lines.

      /-/-- Bram Moolenaar --- Bram@... --- http://www.moolenaar.net --\-\
      \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/
    Your message has been successfully submitted and would be delivered to recipients shortly.