Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
$PATH is different in Vim that in parent shell
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
John Magolske  
View profile  
 More options Jun 23 2012, 4:24 pm
From: John Magolske <listm...@b79.net>
Date: Sat, 23 Jun 2012 13:24:55 -0700
Local: Sat, Jun 23 2012 4:24 pm
Subject: $PATH is different in Vim that in parent shell
I'm finding that $PATH is different in Vim than in the parent shell.
In a shell I see that $PATH reflects what's in my ~/.zshrc :

    % echo $SHELL
    /bin/zsh
    % echo $PATH
    /usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/sbin:/usr/bin:\
    /home/john/bin:/home/john/git/scripts:/home/john/.cabal/bin:\
    /home/john/context/tex/texmf-linux/bin

But within a Vim session launched in that same terminal:

    :!echo $SHELL
    /bin/zsh
    :!echo $PATH
    /home/john/bin:/bin:/sbin:/usr/local/bin:/usr/local/sbin:\
    /usr/bin:/usr/sbin:/usr/NX/bin

... $PATH is different. So when using a shell script located in
/home/john/git/scripts in a mapping in my vimrc, it's necessary to
write out the full path to the executable. Seems this should be
easy to figure out, but searching around I can't come up with an
explanation as to why $PATH is different in Vim.

Thanks for any help,

John

--
John Magolske
http://B79.net/contact


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marc Weber  
View profile  
 More options Jun 23 2012, 4:35 pm
From: Marc Weber <marco-owe...@gmx.de>
Date: Sat, 23 Jun 2012 22:35:03 +0200
Local: Sat, Jun 23 2012 4:35 pm
Subject: Re: $PATH is different in Vim that in parent shell
You can change PATH in vim (as you can change any env var):

let $PATH='/no-such/dir'

and then try :!echo 'hello world'

your shell will no longer be found.

Why is your vim's PATH different? Don't know

vim -V20/tmp/log will show you all viml lines. grep for PATH.

If this doesn't help you the I don't know how to debug it.

env vars can also be changed for child processes, see man exec.
However this should not happen in your shell.

Marc Weber


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul  
View profile  
 More options Jun 23 2012, 6:59 pm
From: Paul <google01...@rainslide.net>
Date: Sat, 23 Jun 2012 23:59:13 +0100
Local: Sat, Jun 23 2012 6:59 pm
Subject: Re: $PATH is different in Vim that in parent shell

On Saturday, 23 June, 2012 at 21:24:55 BST, John Magolske wrote:
>I'm finding that $PATH is different in Vim than in the parent shell.

It looks like you have your PATH set in two different places. Have a look at :help :! and :help shellcmdflag - set it to -ic to see if it helps.

--

.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "$PATH is different in Vim that in parent shell [SOLVED]" by John Magolske
John Magolske  
View profile  
 More options Jun 23 2012, 8:50 pm
From: John Magolske <listm...@b79.net>
Date: Sat, 23 Jun 2012 17:50:55 -0700
Local: Sat, Jun 23 2012 8:50 pm
Subject: Re: $PATH is different in Vim that in parent shell [SOLVED]
* Paul <google01...@rainslide.net> [120623 16:25]:

> On Saturday, 23 June, 2012 at 21:24:55 BST, John Magolske wrote:
> >I'm finding that $PATH is different in Vim than in the parent shell.

> It looks like you have your PATH set in two different places. Have
> a look at :help :! and :help shellcmdflag - set it to -ic to see if
> it helps.

Yes, after doing :set shellcmdflag=-ic to specify that vim use an
interactive shell I see PATH as what I have set in my ~/.zshrc.
But placing "set shellcmdflag=-ic" in my ~/.vimrc creates a behavior
where when Vim is launched it is immediately suspended and I have to
issue `fg` to bring it to the foreground.

Digging around for where else PATH could be set, I found this in
/etc/zsh/zshenv (came from installing Debian via the grml distro) :

    if (( EUID != 0 )); then
        PATH="$HOME/bin:/bin:/sbin:/usr/local/bin:/usr/local/sbin:\
        /usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/games:/usr/NX/bin$ADDONS"
    else
        PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:\
        /usr/local/sbin:/usr/local/bin:/usr/NX/bin$ADDONS"
    fi

Ah...the same path I see when doing :!echo $PATH in Vim.

Commenting out those lines solved the problem not only for Vim, but
for other applications as well (vifm also saw that non-desired PATH).

Thanks for the helpful clues!

John

--
John Magolske
http://B79.net/contact


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »