Ben Schmidt <[EMAIL PROTECTED]> writes:

>>>> Sometimes I add a path to $PATH after login (i.e. after 
>>>> source the .cshrc), and I'm sure I can run that path's 
>>>> command in console, but when I run vim and use :!cmd, then 
>>>> vim will prompt the command not found.
>>>> I have to add that path to $PATH in .cshrc.
>>> 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.
>> 
>> In my .cshrc:
>> 
>> set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin
>> /usr/local/bin $HOME/bin)
>> 
>> ---- Then I start a screen session in urxvt and set the path:
>> 
>> $ screen
>> 
>> $ echo $PATH
>> /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/home/anhnmncb/bin
>> 
>> $ setenv PATH /home/anhnmncb/apps/context/tex/texmf-freebsd/bin:$PATH
>> 
>> $ echo $PATH
>> /home/anhnmncb/apps/context/tex/texmf-freebsd/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/home/anhnmncb/bin
>> 
>> $ context foo.tex   <= runs ok.
>> 
>> $ vim
>> 
>> ----- now I do it in vim:
>> :echo $PATH
>> /home/anhnmncb/apps/context/tex/texmf-freebsd/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/home/anhnmncb/bin
>> 
>> :!context %
>> context: Command not found.
>
> 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).

I notice that when on linux, it hasn't such problem in bash, maybe it's
a problem relative to tcsh? But I'm sorry I can't test it at this time
:(

I just want an env implemented in a particular shell in one particular
screen window, so the ~/.login isn't what I need.

>
> Cheers,
>
> Ben.
>
>
>
>
> >
>

-- 
Regards,

  anhnmncb
 gpg key: 44A31344

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to