Take the 2-minute tour ×

I'm aware that much like a bash prompt in Vim you can press : and get a list of all the history commands by pressing up and down.

But is there a way to export this command history into a buffer?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

:history will show you a history of your commands.


In normal mode, q: will open your history in a new buffer.

share|improve this answer
Can I load it into a new buffer? –  leeand00 Nov 15 '12 at 20:54
Just edited my answer to give you the two possibilities. –  jvivenot Nov 15 '12 at 21:00
hmm kind of a strange buffer, I can't ^w ^w out of it into a new window... –  leeand00 Nov 15 '12 at 21:02
This is a command-line window. If you use <CR>, for example, it will execute the current line command. However, you can yank lines around and put them in another buffer. –  jvivenot Nov 15 '12 at 21:10
If you want a "real" buffer, not the special command-line window, use :redir together with :history, and paste the captured text into a :new buffer. –  Ingo Karkat Nov 16 '12 at 7:55

you can check all the commands by looking into .viminfo in your home folder or :history inside vim

share|improve this answer
is it called _viminfo in Windows?? –  leeand00 Nov 15 '12 at 20:59

Your Answer


