Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I'm not sure if it would be a Windows issue or a porting issue of vim, and I'd be interested to know if any of these suggestions work:

  • as someone already mentioned, try using just <> instead of <STDIN>, which may work better with the C library on Windows, although I'm not sure why it would
  • Try using read() in a loop instead of the bracket operator.
  • Try playing with buffering. It shouldn't make a difference, of course, since you're getting both what's before the text and after it in the same print(). I'd consider it an unknown here, just because the results seem so bizarre.
  • Try some simple debugging on the program, even though the source is working. Make sure your perl gets the variable filled when the script is run from the command line. You've probably already done this, but I can see how it'd be overlooked for such a simple project.

If all else fails, remember that from within vim you can edit a second file, save it, etc. You could yank the needed text, ':new temp' to edit another file, put (paste) the text there, ':w' to write the file, ':!./filter temp' to change the temp file on disk, yank the changed version from that window, quit the new window, reselect the portion in the original file, and paste the buffer over the original section. Since vim has a macro recording function, I'd record parts of that mess as macros. That may be part of what you're trying to avoid, too, though. In any case, it's probably more of a pain than you want.



Christopher E. Stith

In reply to Re^3: 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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-03-28 15:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found