防止 vim 打开文件时更改目录
我刚刚将 MacVim 更新到 7.3,现在它可以将目录更改为我当前正在编辑的任何文件。我使用 PeepOpen,所以每次我想编辑新文件时都需要 cd 回到我的项目目录,这非常烦人。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
编辑 $HOME/vimrc 并添加以下行:
确保 autochdir 未在该配置文件或任何其他配置文件中重置。
Edit your $HOME/vimrc and add this line:
Make sure autochdir isn't reset in that or any other config file.
我意识到这个问题很久以前就被问过,但如果其他人偶然发现这个问题,这里是正确的答案:
在 MacVim 7.3 中,pwd 设置为您打开的第一个文件的目录。此行为在快照 55 中已更改,其中对于已打开的窗口,密码永远不会更改。您可以从这里下载快照(并查看自 7.3 以来的更改):
http://github.com/ b4winckler/macvim/wiki/ChangeLog
注意:'autochdir' 与此无关,也不是 PeepOpen 中的错误。
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.