Xavier de Gaye wrote:

> Assuming the current buffer is the file 'foobar' in the current
> directory. After running the following Vim commands:
> 
>     :python import os
>     :python os.chdir("subdir")
> 
> the current buffer name is not changed as it is when you run
> the Vim command ':cd subdir' (but the output of ':pwd' is Ok),
> and when the following command is run afterwards:
> 
>     :write
> 
> Vim writes the buffer to the file 'subdir/foobar', instead of the
> original file.
> 
> This happens with Vim 7.0 compiled with Python 2.5.

Well, you should not use Python to change directory.  But it may happen
unintentionally...  Checking the current directory after each ":python"
command is a bit inefficient, but that's probably what needs to be done
then.  An alternative is to always chdir back to where we were to undo
the side effect of the Python command.

-- 
If Apple would build a car...
... it would be powered by the sun, be reliable, five times
as fast and twice as easy to drive; but would only run on
five percent of the roads.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

Reply via email to