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

9928Re: mvim on file with path

Expand Messages
  • björn
    Feb 7, 2009
      2009/2/5 Nico Weber:
      >> Hmmm...it only happens if MacVim forks; i.e. if you start with "mvim
      >> -f path/filename" then everything works fine.
      >> Does anybody have any ideas why forking would cause this (Nico,
      >> Ben, ...?).
      > I haven't tested this, but I guess this is what happens:
      > 1.) Vim starts up, parses vimrc (and sets autochdir)
      > 2.) Vim changes the current directory because of autochdir
      > 3.) Vim forks, which basically kills vim and restarts it as a child
      > process
      > 4.) The child process inherits the (changed) current directory
      > 5.) During child startup, vim tries to open the relative path
      > 6.) Since the current directory has changed, the relative path is not
      > resolved correctly

      Yes, that must be what is happening.

      > The best fix I can think of is to store the original directory during
      > vim startup chdir() back to that in the child process before calling
      > exec(). Any better suggestions?

      This sounds a bit too hacked together, but the only other solution I
      can think of is to fork earlier.

      At the moment (as far as I can understand) we only fork after reading
      the rc-files because a user may add "f" to 'guioptions'. Now, my
      question is: does anybody really _need_ this functionality? If we
      crippled this option we could fork right after parsing the command
      line arguments and it would fix the above problems and potentially
      others (that we do not yet know about) as well. Another side-effect
      of this is that we don't have to perform initializations twice which
      would cut down on startup times.

      I would be much more comfortable with this solution. Comments?


      You received this message from the "vim_mac" maillist.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 21 messages in this topic