Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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
share|improve this answer
2  
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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