Re: How to copy with badly wrapped lines in pager
David Champion <dgc <at> uchicago.edu>
2005-05-04 16:08:29 GMT
* On 2005.05.04, in <20050504092252.GA23932 <at> pc1>,
* "Ton Boelens" <linux <at> tonboelens.nl> wrote:
>
> Thanks for you reply. It works, but I get an error 'key not defined'
> with the second part of the macro:
>
> "{snip!}...<display-message><enter-command>unset display_filter<enter>"
I think this problem is the same as Toby mentioned. My mistake; there's
no display-message in pager mode. I meant index. :)
But you can modify the macro to work from pager, too, as Toby did.
> Also, the command par could be replaced by a sed command, or a
> VIM-macro that does 'gqap', sends the output to STDOUT and then exits?
Sed would be tricky, but possible -- but also not very good at the task.
Par uses intelligent algorithms to reflow text, but it would be difficult
to make sed do much more than rewrap lines at 72 columns or something.
If you're happy with that, then I suggest fmt instead -- it's standard
across all Unixes I've seen in the last 10 years or so. But par will get
you good results in perhaps more different cases.
You probably can do something with vim, but I don't know -- I don't use
it. I gather that a lot of par's features have been absorbed into vim's
gq stuff. I have a hunch that vim got it directly from par, at least in
spirit, because "gq" is the essential part of $PARINIT that does most of
the work. I suspect par has more features, but that vim has all of the
most common/useful ones.
(Continue reading)