Hello,

Gary Johnson <[EMAIL PROTECTED]> wrote:

> On 2006-07-27, Luc Hermitte <[EMAIL PROTECTED]> wrote:
>
> > More over I don't have any c:/ drive, and the shell can be anything.
>
> I'm having a little trouble understanding how the shell can be
> anything.

I just meant it can be bash, sh, tcsh, ksh, ...
In a general way, we cannot assume it is always bash.

> What I think you're saying, and what I've understood from
> reading your web pages, is that you launch Cygwin programs from
> within vim using a set of macros, and that if you execute ":sh" or
> ":!" you will be using Windows' cmd.exe.  Is that true?

No. The only times I use $COMSPEC as my main shell (from vim -> 'shell') is when
I test my plugins under different environments.
I have two commands :GoBash and :GoCmd when I need to switch the current shell,
which is quite always bash -- I used to use zsh for a few years.


> What I've been trying to achieve is a vim configuration that looks
> and feels the same under Cygwin as it does under Linux or Solaris;
> so for example, executing ":sh" gives me a Cygwin bash shell and
> executing ":r !ls" inserts the contents of the current directory
> into the current buffer.

That's the easiest part.
However, it will become tricky when you will have to convert posix pathss to
windows paths, assuming you are using win32-vim. This path convertions issue is
what motivated cyg-wrapper.sh and one of the compiler-filter plugins from
BuildToolWrapper.
If you want to have the exact same look and feel, using cygwin-vim is probably
the best solution.

> > BTW, we can also detect cygwin presence with "executable('cygpath')" ;
> > as long as cygwin paths are in the $PATH, because the windows box is set
> > to have cygwin in the $PATH, or because vim is launched from cygwin.
>
> I was trying to allow vim to distinguish between being started from
> a bash shell or from the Command Prompt.  The
> "executable('cygpath')" test will give the wrong answer if
> C:\cygwin\bin is in the Windows PATH.

IIRC, then test if &shell =~ '^.*sh'. Vim uses as the default shell the shell it
as been launched from. I will have a look at it tonight on the box I have cygwin
installed.
(NB for plugin writers: the tricky part with just testing '^.*sh' is that there
are other ports of *nix tools to windows ; I guess a better test would be &sh
=~ '^.*sh' && globpath(substitute($PATH, ':',',','g'), &sh) =~ '.*cygwin')

> [...]
> This is great!  Thank you for the pointers.

You're welcome.

> I think I will be using your cyg-wrapper.sh script and your aliases
> for vim, gvim and explorer.

If you have any comment, do not hesitate.

> I just installed rxvt using Cygwin setup.exe and it seems to work
> fine except when I execute vim:  then my CPU usage goes to 50% and I
> can see vim.exe in the Task Manager process list, but vim never
> appears in the rxvt window.  I finally just kill vim with ^C in the
> rxvt window.  I can execute vim from the Command Prompt and from the
> Cygwin prompt, and I can execute gvim from all three.  I have been
> executing vim as "vim -u NONE" so the problem shouldn't be any of my
> vim files.  Using -V20 didn't show anything, either.  Any idea why I
> can't run vim from rxvt?

As I never use rxvt, I cannot help you here. We will have to know which version
of vim you are using: cygwin-vim or vim32-vim ? In the former case, may be you
can try to start vim with the -X option (-> "do not try to connect to the X
server)


--
Luc Hermitte

Reply via email to