Saturday, November 10, 2012

Re: can't scroll message back after executing external cmd

On Fri, 9 Nov 2012 09:52:53 -0800
Gary Johnson <garyjohn@spocom.com> wrote:

> On 2012-11-09, Johannes Deutsch wrote:
> > Hi all,
> >
> > i wonder, why i can't scroll back the messages from an external
> > command that i invoked within vim via
> >
> > :!<cmd>
> >
> > Right after the command is executed vim puts the whole output of the
> > command on the screen without the more-prompt. Therefore, if the
> > number of lines exceeds the height of the terminal vim is running
> > in, i can't access the first few lines.
>
> When Vim executes an internal command, it sends the output through
> its pager. When Vim executes an external command with :!, it gets
> out of the way and releases control of the terminal to that external
> program.
>
> One way to solve that is to pipe <cmd>'s output to less:
>
> :!<cmd> | less
>

This option is out of question for me since i use gvim most of the time.

> Another is to use Vim's system command to execute <cmd>:
>
> :echo system('<cmd>')
>
> which will use Vim's pager.
>
> This topic was just discussed a few weeks ago but I can't find the
> thread at the moment. I think one of the replies included a script
> that helps solve this problem by using system() but also allowing
> file name expansion on the command line.
>

In terms of the effect the

:echo system('cmd')

variant is what i have been looking for.

Unfortunately many keystrokes are involved. So i will try to find the
script you are referring to.

In the case you find the mentioned thread in the meantime i will be
greatful if you let me know.

With best regards and thank you for taking the time to answer...

> HTH,
> Gary
>

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: