How can I use :perldo in vim on Windows?

1

I installed Git Bash and vim was pre-installed. I personally would rather use PCREs instead of vim's regular expressions, so I tried doing :perldo /s/foo/bar. The error was that it could not find msys-perl5_24.dll. I looked in /usr/bin and it seemed that msys-perl5_26.dll was there instead.

I found this repository of msys packages and installed perl-5.24.4-1-x86_64.pkg.tar.xz. I extracted it and replaced the files in /usr/bin with the ones I just extracted. Now, I get the error ListUtil.c: loadable library and perl binaries are mismatched (got handshake key 0x60029da70, needed 0x0). I'm assuming that the headers need to be updated in /usr/lib/perl5 but I'm not sure where to find the headers. Is there an easier way to make :perldo work in vim? Or does it have to do with however they compile Git Bash?

Alex Hutman

Posted 2019-07-06T03:43:50.853

Reputation: 11

You might want to check out the Vi and Vim Stack Exchange for questions on Vim!

– filbranden – 2019-08-02T14:40:29.593

Answers

0

You could try to change the 'perldll' Vim setting to point to the library that is present in your system.

Perhaps something like:

:set perldll=msys-perl5_26.dll

Or perhaps use a full path to it.

If the symbols for Perl 5.24 and 5.26 are similar enough (or, at least, 5.26 has all the symbols in 5.24, which is a good bet), it might work.

Or does it have to do with however they compile Git Bash?

Yes, it probably does, it's probably the version of Perl they had installed on their build system, so that name got hardcoded as the library to look for.

Is there an easier way to make :perldo work in vim?

You can use the :{range}! command to filter a range through an external command, in which case you can simply call an external Perl binary directly.

For example:

:%!perl -lpe 's/foo/bar/'

Or you could just use Vim regular expressions, they can be as powerful as PCREs in many cases. You might be interested in the \v modifier, which makes Vim regexps "very magic", in which case you don't need to use backslash to access most meta-characters, making them somewhat more PCRE-like.

filbranden

Posted 2019-07-06T03:43:50.853

Reputation: 1 058