Is there a way in vim to view the output of old commands.

For example, if I do:

:! ls 

Gemfile         Gemfile.lock    Rakefile        autotest        config.ru       doc             log             script          vendor
Gemfile.backup  README          app             config          db              lib             public          tmp   

How can I recall this output once I have closed it?

link|improve this question

50% accept rate
feedback

1 Answer

Once you have closed that output it is lost. If you want semi-permanent access to that kind of data you should probably use :redir. See:

:help :redir

For example, open a new window with a blank buffer, redirect all :-command output to register "a", get the output of the "ls" shell command, end redirection, and paste register "a" into the buffer:

:new
:redir @a
:!ls
:redir END
:put a
link|improve this answer
1  
I should note that for shell commands, it's easier just do do ":new" and then ":r!ls", but the :redir trick works for internal Vim commands that produce output. – Heptite May 30 '11 at 1:34
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.