Saturday, August 29, 2009

Re: When I enter !ls the vimrun.exe does not find /bin/tcsh

On 2009-08-29, chiefenne wrote:
> When I enter !ls the vimrun.exe does not find /bin/tcsh
>
> I use the Windows GUI version of vim (7.2).
> I also run cygwin, I start the Windows vim version via cygwin with an
> alias.
>
> I cannot escape to the shell using e.g.:
>
> :!ls
>
> I always get something like:
>
> /bin/tcsh -c "ls"
>
> The system cannot find the specified path.
>
> Seems that something in my environment, either Windows or cygwin is
> wrong.

Since you're running Cygwin, and since your shell is /bin/tcsh, your
environment probably contains

SHELL=/bin/tcsh

Per

:help startup

Windows vim sees that value of SHELL and sets 'shell' accordingly,
which it then uses whenever you execute a command that requires a
shell, such as ":!ls". However, non-Cygwin programs including
Windows vim don't understand full Cygwin paths and don't see the /bin
directory.

There are probably several ways to solve this problem, but what I've
done is to put these lines early in my .vimrc:

if has("win32") && $SHELL == "/bin/bash" && executable("C:/cygwin/bin/bash")
" Running in Cygwin.

if executable("C:/WINDOWS/system32/cmd.exe")
let $SHELL=''
set shell=C:\\WINDOWS\\system32\\cmd.exe
" Unlike other places in
" Vim, the 'shell' path must
" use backslashes. I don't
" know why.
endif
endif

You'll want to change my /bin/bash to /bin/tcsh.

HTH,
Gary

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

No comments: