Xaizek wrote:

> On running gvim like this
> 
>     gvim --remote-tab-silent /some/path
> 
> Vim sends the following commands to server instance (this is just a
> piece of bigger set of commands):
> 
>     cd /current/path
>     tab drop /some/path
>     if !exists('+acd') || !&acd
>         cd -
>     endif
> 
> `tab drop /some/path` triggers auto-commands, where one might want to
> change directory for a new buffer.  *But* if 'autochdir' is not available
> or disabled, `cd -` will overwrite that directory change.
> 
> I thought about adding a check to execute `cd -` only if we're still in
> "/current/path" to implicitly detect directory changes made from
> autocommands, like this
> 
>     if (!exists('+acd') || !&acd) && getcwd() ==# "/current/path"
>         cd -
>     endif
> 
> I made a sample patch, which seems to work, but there is probably a
> better way to handle escaping and I didn't bother looking it up yet as I'm
> not sure it's the best way to handle this issue.
> 
> So, is there a better way to fix this?  If not, please comment on the patch.
> I'm particularly interested in ensuring that comparison with the path will
> be syntactically correct, i.e. escaping will be done correctly for all
> possible paths.

One more thing to keep in mind:  The first "cd" is global, if the
autocommands only change the local directory then the global directory
still needs to be restored.


-- 
Microsoft's definition of a boolean: TRUE, FALSE, MAYBE
"Embrace and extend"...?

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui