问题描述
我使用MacVim(基本上是gvim的mac)。
如果我从命令行打开macvim,那么我的 $ PATH
变量将被正确设置。
如果我通过点打开macvim并点击finder,则 $ PATH
变量将不会正确设置。
任何人都能给我一些见解?
注意:我知道我的路径的至少一部分设置在〜/ .bashrc
,但我不是确保其余的设置。
示例:
如果我从终端打开macvim:
%gvim basic.tex
pre>
然后在MacVim我去:
:!echo $ PATH
/opt/local/bin:/opt/local/sbin:/sw/bin:/sw/sbin:/Applications/MacVim.app/Contents/M
acOS:/ bin:/ sbin:/ usr / bin:/ usr / sbin:/ usr / local / bin:/ usr / texbin:/ usr / X11R6 / bin
这是正确的路径。
当我用鼠标(在finder中)打开文件
当我去时:
:!echo $ PATH
/ usr / bin:/ bin:/ usr / sbin:/ sbin
为什么?
解决方案在Mac上为GUI应用程序设置环境变量
的位置(通过loginwindow启动,
Finder等)是〜/ .MacOSX / environment.plist
或者在MacVim中,您可以选择在login-shell中启动vim进程(查看首选项)。
有关详情,请参阅。
I am using MacVim (basically gvim for the mac).
If I open macvim from the command line then my
$PATH
variable will be properly set.If I open macvim via point and click with the finder, the
$PATH
variable will NOT be properly set.Can anyone give me some insight?
Note: I know at least part of my path is set in
~/.bashrc
, but I am not sure where the rest of it is set.Examples:
If I open macvim from the terminal:
% gvim basic.tex
And then in MacVim I go:
:!echo $PATH /opt/local/bin:/opt/local/sbin:/sw/bin:/sw/sbin:/Applications/MacVim.app/Contents/M acOS:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/texbin:/usr/X11R6/bin
This is the right path.
When I open the file with the mouse (in finder)
When I go:
:!echo $PATH /usr/bin:/bin:/usr/sbin:/sbin
It gives me a little path. Why?
解决方案The place to set environment variableson the Mac for GUI applications (those started via loginwindow, theFinder, etc.) is
~/.MacOSX/environment.plist
Alternately in MacVim you can choose to launch vim processes in a login-shell (look in the preferences).
For more info see this post.
这篇关于$ PATH变量在gvim / MacVim中从查找器打开时未正确设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!