On Feb 19, 2011, at 8:40 AM, Ben Schmidt wrote: >> Coincidentally, today I had some problems involving wrong paths on vim >> (seems like I hadn't fixed anything after all), so I did some tests >> with vim, gvim and gvim launched from the terminal, and the paths >> appear to be created in the following way: >> >> 1.- vim: >> :echo $PATH => ($PATH from .zshrc) >> :!echo $PATH => ($PATH from /etc/paths)+($PATHs from >> /etc/paths.d/*)+($PATH from .zshrc) >> >> 2.- gvim: >> :echo $PATH => ($PATH from .zprofile) >> :!echo $PATH => ($PATH from /etc/paths)+($PATHs from >> /etc/paths.d/*)+($PATH from .zprofile) >> >> 3.- gvim from terminal: >> :echo $PATH => ($PATH from .zshrc) >> :!echo $PATH => ($PATH from /etc/paths)+($PATHs from >> /etc/paths.d/*)+($PATH from .zshrc) >> >> Why the difference between the $PATHs? The second form is what >> path_helper returns. > > Hmm. OK. So when zsh is used by Vim to run external commands we have the > problem. Looks like it's caused by /etc/zshenv, which calls path_helper > for all zsh invocations, not just login shell invocations. That's not > right, really, so it's a bug in how Mac OS X is set up. /etc/zshenv > should be used by a sysadmin to set environment variables that restrict > the shell so that users can't do stuff they shouldn't be allowed to; it > shouldn't be used to set the PATH which is a user-controllable thing > that should be inherited by non-login shells. > > Since when Vim runs external commands, it's not an interactive shell, > zshrc stuff is not read, and it's not a login shell so zprofile is not > read, so the path cannot really be fixed by these files. > > So the path_helper stuff in /etc/zshenv should really needs to be moved > to /etc/zprofile where it belongs. Then it will only affect login > shells, and login is the correct time to set the path. And this still > happens before the ~/.zprofile stuff, so users can change it at login, > and before zshrc stuff, so sysadmin or users can adjust it for > interactive use. This is all how it should work and how vim kinda > assumes it will work. > > So > > sudo mv /etc/zshenv /etc/zprofile > > and I think everything will be good! (Be careful that /etc/zprofile > doesn't already exist. If it does, obviously you need to merge the > contents of zshenv into it, rather than just replacing it.) > > Hope this helps. Do let us know the verdict....
Many thanks, Ben. Israel -- You received this message from the "vim_mac" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php