OS is freebsd 7-stable.
Shell is tcsh.
--
Regards,
anhnmncb
gpg key: 44A31344
In Vim, does the following show the correct PATH?
:echo $PATH
:put =$PATH
The second command will insert it into the current buffer for inspection.
Of course Vim just asks the operating system to handle '!cmd' so the only issue is
whether the PATH is inherited by the process started by Vim (I would say "yes").
First point is to decide if Vim's process has that info.
John
How do you do that? Did you export it? If you just do
set PATH=whatever
in a shell, it will only apply in the shell, not to processes started by
the shell, you need to do
setenv PATH=whatever
or perhaps at an appropriate point set the environment variable to equal
the shell variable with something like
setenv PATH=$PATH
Ben.
I think it's because the :! command in Vim starts a new shell. Because
your .cshrc sets path, when this new shell is started, the shell reads
its .cshrc and clobbers the PATH that it was passed in the environment.
You should probably solve this by putting your alteration to path in
~/.login (or ~/.csh.login?) instead of ~/.cshrc so it only happens for a
login shell, not every shell, since you actually want non-login shells
to inherit the environment from their parent process. Even better would
be to have it as an alteration to the system default path in ~/.login
(i.e. prepend or append to the existing $PATH rather than setting it
outright).
Cheers,
Ben.
You would have the same problem in bash if you did the same thing in
your .bashrc.
> I just want an env implemented in a particular shell in one particular
> screen window, so the ~/.login isn't what I need.
Yes, I understand. I'm not suggesting you put your context path in
.login, I'm suggesting you move
> set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin
> /usr/local/bin $HOME/bin)
from .cshrc to .login.
The problem is that when Vim does :! it starts tcsh, which reads .cshrc,
which runs that line above which sets the path so it loses the path the
Vim had that included the context path.
Just removing that line above from your .cshrc should fix it, but
obviously that's not what you want. Nor do you want to change that line
to something that includes $PATH on its right hand side, because doing
that would mean the path would get longer and longer every subshell that
got started (and many do!). The best thing is to put it in .login.
Ben.
I don't know about [t]csh, but bash determines which scripts to source
at startup according to whether or not it's a login shell and whether or
not it's an interactive shell. When Vim starts a bash shell, to handle a
:! command, it is (in the general case) neither a login shell nor an
interactive shell, and it inherits the environment from Vim, though some
settings may be modified before the :!command is run.
Best regards,
Tony.
--
Please try to limit the amount of "this room doesn't have any bazingas"
until you are told that those rooms are "punched out". Once punched
out, we have a right to complain about atrocities, missing bazingas,
and such.
-- N. Meyrowitz
Problem has resolved :) I think tcsh reads .cshrc no matter if is login shell
or interactive shell.
>
>
> Best regards,
> Tony.