Friday, April 16, 2010

Capture output of a command

I was playing around with ^K and wanted to see all possible combinations available. :help CTRL-K directed to the :digraphs command. The problem is that amount of output from :dig eclipses even that of the :set all.

So how one can somehow serialize the output into e.g. a VIM's buffer?

Search on the net unveiled the following tip:

:redir @a
:dig
:redir END


Or even cooler, putting the output into a variable:

:redir => varname
:dig
:redir END


followed by echo varname.

Final step is the dumping all that into a buffer/window: :put =varname.

P.S. The official Learn to use help article. Til now, I haven't knew that the :help could be abbreviated to the :h.

No comments: