Filter through Cygwin command, not CMD + python as extension language

14 views
Skip to first unread message

Guillermo

unread,
Jul 28, 2008, 8:04:04 AM7/28/08
to vim_use

Hi there!

I'm new to vim (gvim). Is there an easy way to use the filter command
(!) to filter the buffer/selection through a cygwim command line tool?

Is it enough to put the executables path in Windows' PATH variable?

Also, I'm told that versions > 7 for Windows are compiled with python
bindings, but when I try to execute

:python print "hi"

vim comes back with an error complaining that can't load python24.dll.

Regards,

Guillermo

Ben Schmidt

unread,
Jul 28, 2008, 8:50:44 AM7/28/08
to vim...@googlegroups.com
> I'm new to vim (gvim). Is there an easy way to use the filter command
> (!) to filter the buffer/selection through a cygwim command line tool?
>
> Is it enough to put the executables path in Windows' PATH variable?

That should work, yes. Try it and see!

Beware of differences between Windows paths and Cygwin paths if you are
mixing Cygwin and standard executables. There are also Cygwin and
regular Windows versions of Vim, so if you use Cygwin, you may like to
install (or even compile and install--indeed that may be necessary) a
Cygwin version rather than use the regular Windows one.

> Also, I'm told that versions > 7 for Windows are compiled with python
> bindings, but when I try to execute

They are compiled with python/dyn, I believe, which means they will load
python if (and only if, of course) the required python dll is present.
You need to install that from elsewhere.

:help python-dynamic

Smiles,

Ben.


Guillermo

unread,
Jul 28, 2008, 9:16:41 AM7/28/08
to vim_use

Ok, now I understand!

Thanks, Ben.

I've been looking around, but I can't find an easy way of getting hold
of a python 2.4 dll for Windows short of installing that release...

Cheers,

Guillermo

ThoML

unread,
Jul 28, 2008, 9:17:46 AM7/28/08
to vim_use
> regular Windows versions of Vim, so if you use Cygwin, you may like to
> install (or even compile and install--indeed that may be necessary)

Cygwin comes with it's own native version. With cygwin gcc you can
also compile the windows version though. It's really simple.

> vim comes back with an error complaining that can't load
> python24.dll.

That's because you don't have python24 (the windows version for
windows gvim) installed or the dll isn't in your path. GVIM sometimes
lags behind with respect to the required version of python/ruby etc.
If you want to use a newer version of python, you might need to get a
different version of gvim or compile it yourself.

John Beckett

unread,
Jul 28, 2008, 7:16:53 PM7/28/08
to vim...@googlegroups.com
Guillermo wrote:
> I've been looking around, but I can't find an easy way of
> getting hold of a python 2.4 dll for Windows short of
> installing that release...

As mentioned, compiling your own Vim is probably the best option. Unfortunately,
however, the docs for doing that are a bit disjointed. I'm hoping that one day we
will have a master "building Vim" tip on the wiki (vim.wikia.com), with separate
tips for details on Unix, Windows, Cygwin etc.

Assuming you have Python 2.5 and a gvim that looks for Python 2.4, you might be able
to just patch the exe file. A quick look shows that "python25.dll" occurs once in my
gvim.exe (you would have "python24.dll"). (It does occur more than once, but the
other occurrences are in the text of the compile commands, presumably shown by
':version'.)

John

Matt Wozniski

unread,
Jul 28, 2008, 9:24:25 PM7/28/08
to vim...@googlegroups.com

AFAICS, that would only work if python didn't change its ABI at all in
the jump from 2.4 to 2.5 - which I find very unlikely. The fact that
building vim with python requires being able to find python
development headers means that we're worried about the API changing,
and so a version bump almost certainly means the ABI changed...
Though I'm no expert on such matters, so perhaps I'm not seeing
something.

~Matt

Ben Schmidt

unread,
Jul 28, 2008, 9:51:00 PM7/28/08
to vim...@googlegroups.com
> AFAICS, that would only work if python didn't change its ABI at all in
> the jump from 2.4 to 2.5 - which I find very unlikely. The fact that
> building vim with python requires being able to find python
> development headers means that we're worried about the API changing,
> and so a version bump almost certainly means the ABI changed...
> Though I'm no expert on such matters, so perhaps I'm not seeing
> something.

Yes. I suspect even if this appeared to work it would be dangerous. Vim
uses the C preprocessor to adapt its code to the Python version,
including compiling different code for Python 2.5, so there must be some
distinction that matters at least somewhere.

Ben.


John Beckett

unread,
Jul 28, 2008, 10:15:15 PM7/28/08
to vim...@googlegroups.com
Matt Wozniski wrote:
> AFAICS, that would only work if python didn't change its ABI
> at all in the jump from 2.4 to 2.5 - which I find very
> unlikely.

OMG -- did I write that?? Yes, I had totally overlooked what was going on. Thanks
for the correction.

John

Tony Mechelynck

unread,
Jul 30, 2008, 2:32:07 AM7/30/08
to vim...@googlegroups.com
On 29/07/08 01:16, John Beckett wrote:
> Guillermo wrote:
>> I've been looking around, but I can't find an easy way of
>> getting hold of a python 2.4 dll for Windows short of
>> installing that release...

Indeed, that's the "official" way to do it, and if you haven't got
python yet, or have got an older version, it ought to work. If what you
have is Python 2.5 you can also avail yourself of Steve Hall's vim/gvim
7.1.327 for Windows, which supports MzScheme 3.70, Perl 5.8, Python 2.5,
Ruby 1.8 and TCL 8.4 if they are installed. It's available at
https://sourceforge.net/project/showfiles.php?group_id=43866&package_id=39721

Of course, if you currently have a newer version installed than even
Python 2.5, or if you want a Vim 7.2 beta release, it's always painful
to have to downgrade software so in that case I suppose the best thing
to do is to compile Vim yourself.

>
> As mentioned, compiling your own Vim is probably the best option. Unfortunately,
> however, the docs for doing that are a bit disjointed. I'm hoping that one day we
> will have a master "building Vim" tip on the wiki (vim.wikia.com), with separate
> tips for details on Unix, Windows, Cygwin etc.

My Vim site http://users.skynet.be/antoine.mechelynck/vim/ includes two
step-by-step HowTo pages, showing how I used to compile Vim on Windows
and how I'm doing it now on Linux. They are older than the vim.wikia but
I'm keeping them up to date, and I'm not moving them there because this
way I can stake my reputation on the contents.

Since Cygwin is a Unix-like OS, you should be able to use my
"Unix-Linux" HowTo to compile Vim "for Cygwin" but I never troubled with
that myself -- I used Cygwin to compile vim and gvim versions "for
Windows" which didn't need the cygwin1.dll to run. In the rare cases
when I needed to call Vim from cygwin bash I used the console vim
version distributed with Cygwin.

>
> Assuming you have Python 2.5 and a gvim that looks for Python 2.4, you might be able
> to just patch the exe file. A quick look shows that "python25.dll" occurs once in my
> gvim.exe (you would have "python24.dll"). (It does occur more than once, but the
> other occurrences are in the text of the compile commands, presumably shown by
> ':version'.)
>
> John

Guillermo, that's an "unsupported" procedure. It might work, but at your
own risk. Don't complain here (not even to John) if such a "hacked"
binary crashes your hard drive, kicks your dog to death, puts your youse
on fire and elopes with your wife. You've been warned!


Best regards,
Tony.
--
One nice thing about egotists: they don't talk about other people.

Reply all
Reply to author
Forward
0 new messages