Prevent vim from changing directories when opening files
I just updated 开发者_StackOverflow社区my MacVim to 7.3 and with it, it now changes directories to whatever file I'm currently editing. I use PeepOpen, so it's incredibly annoying to cd back to my project directory every time I want to edit a new file.
Edit your $HOME/vimrc and add this line:
set noautochdir
Make sure autochdir isn't reset in that or any other config file.
I realize that this question was asked long ago, but in case somebody else stumbles onto this here is the correct answer:
In MacVim 7.3 the pwd is set to the directory of the first file you open. This behavior was changed in Snapshot 55 where the pwd is never changed for an already open window. You can download the snapshot (and see changes since 7.3) from here:
http://github.com/b4winckler/macvim/wiki/ChangeLog
Note: 'autochdir' has nothing to do with this, nor is it a bug in PeepOpen.
精彩评论