0

I am trying to compile a code from within neovim (using ':make'). But it turns out that neovim does not take into consideration the PATH variable with which neovim has been invoked - neovim uses instead the PATH variable that is set by the .tcshrc script.

More explicitly :

in .tcshrc , PATH variable contains the path /usr/bin. I update PATH manually (PATH=/mynewversionofgcc/bin:$PATH) prior invoking neovim. Doing this, I was hoping that the ':make' command would have used gcc that is located into /mynewversionofgcc/bin. It turns out that it is gcc located into /usr/bin that is being used instead.

Going further :

the command :call system("echo $PATH > foo") shows that PATH in the subshell is not the same as the path of the environment in which neovim has been invoked. (as if .tcshrc was run prior the shell command).

Whereas the command :echo luaeval('os.getenv("PATH")') returns the PATH that is exactly the same as the one of the term where nvim is launched.

Is there a way to get the same PATH inside the subprocess without modifying .tcshrc ?

Pierre G.
  • 4,346
  • 1
  • 12
  • 25
  • How do you exactly update the `PATH` variable and then invoke nvim? Do you use `export` to set PATH or something else? That may be the key to your issue. – jdhao Feb 18 '22 at 10:43
  • Hi - I am using tcsh. I have tried 2 methods (either setenv or set) - both provide same result (not working as expected) - unless if I modify my .tcshrc (if I modify the path prior nvim via set path=... or setenv PATH... - it does not work; it works only when .tcshrc is modified, using set path = ...). In another tcsh environment (on a personal Ubuntu laptop), I do not have this issue at all... may be sth obvious just under my nose, but I cannot see it ! – Pierre G. Feb 18 '22 at 11:33
  • Or you can just set the variable inside nvim using something like `let $PATH=/some/path`. This is a hack though. – jdhao Feb 19 '22 at 01:53

0 Answers0