Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Capturing the output of a vim command into a buffer or register

4 views
Skip to first unread message

Mumia W.

unread,
Dec 18, 2009, 7:04:12 PM12/18/09
to
How do I capture the output of a vim command into a buffer or register?

The ":digraphs" command creates a list of digraphs supported by vim. I
want to save this to a file, but first, I need to find a way to tell the
:digraphs command to save to a buffer rather than to display to the
screen. How can I do this?

Gary Johnson

unread,
Dec 19, 2009, 3:02:43 AM12/19/09
to

You can capture the output to a register, a variable or a file. See

:help :redir

For example, to save the output of :digraphs directly to a file,

:redir > dgfile
:digraphs
:redir END

For commands whose output is so long that vim pauses the output and
displays a "more" prompt, you may want to set 'nomore' before executing
the command and restore 'more' afterward. See

:help 'more'

--
Gary Johnson

Mumia W.

unread,
Dec 19, 2009, 4:45:53 AM12/19/09
to


Thank you so much. That is precisely what I was looking for. I read
/all/ of eval.txt and options.txt (in the VIM help) and was still unable
to find that option, which is mentioned in various.txt. :-)

I knew vim could do it. VIM can do almost anything ;-)

0 new messages