Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to call some shell command from vim with like :!ls command. But unfortunately there are some default PATHS that prepends PATHs defined in the original shell. Here is the echo $PATH output in the original shell:


and shell called within vim:


Why they appeared right there? How can I prevent that and make vim shell has original PATH variable.

share|improve this question
up vote 1 down vote accepted

See this answer of mine or this one with a nice table to similar questions. You should check the file in which you setup your custom $PATH. Whether it's ~/.profile or ~/.bashrc or some other file and the method of invocation of the shell have their role in this.

For reference, I have only one line in my ~/.bashrc:

source ~/.profile

(with all my settings going into ~/.profile) and this line in my ~/.vimrc:

set shell=bash\ -i

The whole thing is not very pretty but it's simple and it works.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .