Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

For example, if I do:

:! ls 

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

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

share|improve this question

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:

:redir @a
:redir END
:put a
share|improve this answer
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .