This is the mail archive of the
cygwin-xfree@cygwin.com
mailing list for the Cygwin XFree86 project.
RE: using cygwin's Perl from within gvim
> On Wed, 22 Oct 2003, Lyle wrote:
>
> > Hello
> >
> > I am unable to use Perl from within gvim. For example, if within
> > gvim, I type
> > Esc :%!perl -p -e 's/public/private/;' and hit return,
> >
> > nothing happens, where as if I issue this exact same command
> >
> > cat filename.java | perl -p -e 's/public/private/;'
> >
> > from the cygwin bash command line (outside of gvim), then it works as
> > expected. When attempting to execute this command from the
> > gvim editor, as shown above, a shell window appears and then
> > disappears immediately, causing me to suspect that some sort
> > of error message is being displayed, but its too fast to read it.
> >
> > Attempting this same action using gvim and Perl on AIX Unix
> > works fine, so its not a mistake in the Perl syntax.
> >
> > I'm using VIM 6.1 (2002 Mar 24, compiled Mar 24 2002 16:04:44)
> > MS-Windows 32 bit GUI version with OLE support on Windows XP.
> >
> > Any ideas?
Lyle,
Both of the answers below are clear, concise, and not quite correct.
On Wed, 22 Oct 2003, Jörg Schaible wrote:
> Yes. GVIM is not a Cygwin application and will provide perl with a
> temporary file name in DOSish format. Since Cygwin's perl expect files
> in standard Unix format, this won't work. For GVIM use a Win32-aware
> perl from the perl home page or from ActiveState.
>
> Regards,
> Jörg
AFAIK, the temporary file management is done by gvim itself, and it simply
execs the program, pipes the file to it, and redirects the output into a
temp file (i.e., from perl's point of view, it's just a filter
invocation). I suspect the problem is with argument quoting and/or
finding the right perl executable.
On Wed, 22 Oct 2003, Gerrit P. Haase wrote:
> You cannot use Cygwin Perl from within an Windows application, try to
> use ActiveStates or another native Windows Perl, or use Cygwin Vim/Gvim.
>
> Gerrit
That is plainly not true (sorry, Gerrit). While trying ActivePerl is a
good suggestion, you *can* use Cygwin apps from non-Cygwin programs as
long as you're careful about paths and argument quoting. I'd suggest
trying something like
ESC :%!c:\cygwin\bin\bash --login -c "perl -pe 's/public/private/;'"
to make sure the right perl is found and the arguments are properly quoted
(the --login ensures you have the right PATH). Alternatively, you could
try setting the "shell" variable within gvim to "c:\cygwin\bin\bash". If
"c:\cygwin\bin" is in your system PATH and you don't have other bashs or
perls installed, you can probably omit the "c:\cygwin\bin" and "--login"
bits.
Igor
P.S. What does this discussion have to do with XFree86, BTW? ;-)
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha@cs.nyu.edu
ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster." -- Patrick Naughton