On 2009-02-10, Tony Mechelynck <[email protected]> wrote:
> On 09/02/09 14:45, WiggyWare wrote:
> > I'm trying to use :!command to execute commands without dropping
> > into :sh, but they seem to behave differently.
> >
> > For instance, when I do an 'alias' from :sh, it properly shows me the
> > aliases set up in .kshrc (using ksh). If I do :!alias, I do not get
> > any of the aliases I set up in my .kshrc.
> >
> > Does anyone know how to rectify this, or at least explain it?
> >
> > Thanks very much in advance!
> > Bill Yoder
> 
> IIUC, Vim runs your usual shell, but as a non-interactive shell. This 
> means that bash won't source .bashrc, ksh won't source .kshrc, etc.
> 
> In Console mode, or when started in GUI mode from a shell, this should 
> not be a problem, since in that case Vim runs in an environment set up 
> by an earlier (interactive) shell, and passes that to every child process.

It's still a problem because unlike environment variables, aliases
are not exported to child processes.  (I think there are some
exceptions to this, but they don't apply in this case anyway.)

> To define your aliases even in a non-interactive shell, define them in 
> ~/.profile or (system-wide) /etc/profile rather than in .bashrc or 
> .kshrc (or the equivalent *rc files for csh, zsh, etc.).

That doesn't work, at least not for ksh or bash.

Regards,
Gary



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

Reply via email to