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.

When started from a desktop icon, or from the "Execute" menu on the 
taskbar, OTOH, there is no previous shell, and there are no preset 
variables to pass.

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.).

If sh (when interactive) gets you the same aliases as ksh, it could mean 
that your sh is actually softlinked to ksh, the way on my system is it 
softlinked to /bin/bash.


Best regards,
Tony.
-- 
God made the world in six days, and was arrested on the seventh.

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

Reply via email to