It works for me with vim version 6.1.320 and the code you posted.

I saved the code into a file named 'filter', set the file to be executable, and called it with the relative path on the command line. Here's the command I used in vim:

:1,$!./filter
The command ':!program' just runs an external program, it doesn't filter. You have to provide a range either at the colon prompt, by visual selection, or by motion selection. When I used just the ':!./filter' command as you suggest, it waited for me to type the input to the filter program, and to send it an end-of-file character.

If you can't make the program executable, then you may need to use ':!perl program' instead. That works for me, too.

This is really a vim question from what I can tell, as the program you provided works for me the same as any other. However, your node mentions Windows, and I don't have any form of vi on any of my Windows machines at the moment. There's no way for me to tell if there's something strange going on with a platform issue here.



Christopher E. Stith

In reply to Re: How do I create a simple, perl-based text filter for Vim by mr_mischief
in thread How do I create a simple, perl-based text filter for Vim by dimar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.