I'm trying to configure the $PATH env variable of vim's internal shell.

I have commands that update the $PATH several times during a session. I see that vim inherits my shell's first $PATH - but not updated $PATH variables.

Some things that might be helpful:

  • I open vim multiple times - with changes to $PATH in between
  • The internal shell does source cshrc every time I launch the internal shell
  • Sourcing cshrc on the main shell doesn't change $PATH

-- update So the problem is because the .cshrc file. It does some initial setting up where the path gets reset. Launching a new shell within the current shell resets $PATH. I'll have to figure out a way to go around this.

I'm using tcsh on a redhat machine. Any clue why this is happening and how to fix this?

  • How do you start Vim – once per session, or every time? – user1686 Jun 13 '12 at 22:53
  • Multiple times - with changes to $PATH in between (when vim is closed). Maybe vim's internal shell sources .cshrc/etc? Could that reset the $PATH everytime? – Utkarsh Sinha Jun 13 '12 at 22:54
  • 1
    It could be that... echo "starting cshrc" is a good debugging tool, by the way. – user1686 Jun 13 '12 at 23:02
  • Hmm - it does source cshrc. But I tried sourcing it in the actual shell. It doesn't change $PATH there. – Utkarsh Sinha Jun 13 '12 at 23:22

If you don't want your internall shell to source .cshrc, try passing an option to it, by setting shellcmdflag, e.g.:

set shellcmdflag=--norc

This will only affect the shell when using ! and :!. To affect also :shell use:

set shell=bash\ --norc

(of course replace that with your shell of choice and the correct option to skip reading the rc file).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.