"paging" output from other programs, e.g., sed

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

"paging" output from other programs, e.g., sed

Matthew Huggett
Hi,

I often call sed from within Vim to search a language dictionary (e.g.,
:!sed /pattern/ dictionary).  Sometimes there are more than a screenful
of results and they just go flying past.  Is it possible to have the
results broken into pages (like when using 'less' or 'more' in a
terminal)?  So far, I've just been redirecting the output to a register
(e.g., :redir @a) and then pasting it into a buffer, but this is not
very convenient.

Thanks

Matt
Reply | Threaded
Open this post in threaded view
|

Re: "paging" output from other programs, e.g., sed

A.J.Mechelynck
----- Original Message -----
From: "Matthew Huggett" <[hidden email]>
To: <[hidden email]>
Sent: Monday, August 08, 2005 5:23 AM
Subject: "paging" output from other programs, e.g., sed


> Hi,
>
> I often call sed from within Vim to search a language dictionary (e.g.,
> :!sed /pattern/ dictionary).  Sometimes there are more than a screenful
> of results and they just go flying past.  Is it possible to have the
> results broken into pages (like when using 'less' or 'more' in a
> terminal)?  So far, I've just been redirecting the output to a register
> (e.g., :redir @a) and then pasting it into a buffer, but this is not
> very convenient.
>
> Thanks
>
> Matt
>
>

Open a new window, then read the output there:

    :new
    :$r !sed /pattern/ dictionary

You can leave the window open and add the output of additional commands at
the bottom (by repeating ":$r !command"), clear it by ":enew!" or close it
by ":q!" anytime. Don't forget the space between r and !, or the ! after
enew or q.

You might also be interested by the new ":vimgrep" command (Vim version 7
only). It acts as an "internal grep" feature, with output to the |quickfix|
subsystem of Vim.


Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: "paging" output from other programs, e.g., sed

Mikołaj Machowski
Dnia poniedzia?ek 08 sierpie? 2005 05:42, Tony Mechelynck napisa?:
>
> You might also be interested by the new ":vimgrep" command (Vim version
> 7 only). It acts as an "internal grep" feature, with output to the
> |quickfix| subsystem of Vim.
>
Vim7 has also very nice paging.

m.

Reply | Threaded
Open this post in threaded view
|

Re: "paging" output from other programs, e.g., sed

Gary Johnson
In reply to this post by Matthew Huggett
On 2005-08-08, Matthew Huggett <[hidden email]> wrote:
> Hi,
>
> I often call sed from within Vim to search a language dictionary (e.g.,
> :!sed /pattern/ dictionary).  Sometimes there are more than a screenful
> of results and they just go flying past.  Is it possible to have the
> results broken into pages (like when using 'less' or 'more' in a
> terminal)?  So far, I've just been redirecting the output to a register
> (e.g., :redir @a) and then pasting it into a buffer, but this is not
> very convenient.

You could just pipe the output of your command into 'less' or
'more', e.g.,

    !sed /pattern/ dictionary | less

HTH,
Gary

--
Gary Johnson                 | Agilent Technologies
[hidden email]     | Wireless Division
                             | Spokane, Washington, USA
Reply | Threaded
Open this post in threaded view
|

Re: "paging" output from other programs, e.g., sed

Matthew Huggett
 > You could just pipe the output of your command into 'less' or
 > 'more', e.g.,
 >
 >     !sed /pattern/ dictionary | less
 >
 > HTH,
 > Gary

That's the obvious solution! :-) (Although it works for me now, I swear
  I tried it before without success.)

The other solution that I was given that worked very well was to do

:new
:$r sed /pattern/ dictionary

and then
:enew!
to clear the window between searches.

Thanks for the suggestions,

Matt