I just updated 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.
+3
A:
Edit your $HOME/vimrc and add this line:
set noautochdir
Make sure autochdir isn't reset in that or any other config file.
Paul Tomblin
2010-09-01 19:44:36
I'm getting `E518: Unknown option: noautochdir` after setting that and trying to run vim. Strange, since it's in the docs.
Trevor Hartman
2010-09-01 20:38:37
I set it in .gvimrc instead and don't get any errors, but MacVim is still switching directories.
Trevor Hartman
2010-09-01 20:46:06
It appears PeepOpen is responsible for changing the directory, not vim itself, unless there's some setting in vim where it changes directories if a file is opened from an external app like PeepOpen. When I do a normal :e some/file it doesn't change directories.
Trevor Hartman
2010-09-01 20:50:06
A:
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.
Björn Winckler
2010-10-15 17:57:48
Thanks for posting. I saw you also posted in the PeepOpen issue tracker and grabbed the new snapshot :) Working beautifully.
Trevor Hartman
2010-10-15 22:33:33