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
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.
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
Friday, November 9, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment