I use the autochdir option in VIM and I also utilize VIM's built-in Python interface. Is it possible to have the current directory for the built-in Python interpreter follow VIM's autochdir. For example, when I am editing a Python file, VIM's autochdir option puts me in the same directory as the edited file as far as VIM is concerned, but I still have to manually
:py os.chdir(directory)
from the VIM command li开发者_如何学Gone in order to get the Python interpreter to recognize the same directory that VIM has.
Is this possible? I'm using VIM 7.2 on Windows.
You could try putting in vimrc
autocmd Filetype python py os.chdir(directory)
which means that whenever a python file is read or written, it executes this command.
精彩评论