从查找程序打开时,$PATH 变量未在 gvim/MacVim 中正确设置 [英] $PATH variable not properly set in gvim/MacVim when it is opened from the finder

查看:23
本文介绍了从查找程序打开时,$PATH 变量未在 gvim/MacVim 中正确设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 MacVim(对于 mac 基本上是 gvim).

I am using MacVim (basically gvim for the mac).

如果我从命令行打开 macvim,那么我的 $PATH 变量将被正确设置.

If I open macvim from the command line then my $PATH variable will be properly set.

如果我通过点打开 macvim 并用查找器单击,$PATH 变量将无法正确设置.

If I open macvim via point and click with the finder, the $PATH variable will NOT be properly set.

谁能给我一些见解?

注意:我知道我的路径至少有一部分是在 ~/.bashrc 中设置的,但我不确定其余的路径是在哪里设置的.

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.

示例:

如果我从终端打开 macvim:

If I open macvim from the terminal:

% gvim basic.tex 

然后在 MacVim 中我去:

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 

这是正确的道路.

当我用鼠标打开文件时(在查找器中)

When I open the file with the mouse (in finder)

我去的时候:

:!echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin  

它给了我一条小路.为什么?

It gives me a little path. Why?

推荐答案

设置环境变量的地方在 Mac 上用于 GUI 应用程序(那些通过登录窗口启动的,Finder 等)是 ~/.MacOSX/environment.plist

The place to set environment variables on the Mac for GUI applications (those started via loginwindow, the Finder, etc.) is ~/.MacOSX/environment.plist

或者在 MacVim 中,您可以选择在登录外壳中启动 vim 进程(查看首选项).

Alternately in MacVim you can choose to launch vim processes in a login-shell (look in the preferences).

更多信息参见这篇文章.

这篇关于从查找程序打开时,$PATH 变量未在 gvim/MacVim 中正确设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆