Thursday, June 28, 2012

Re: vim: use external program, but direct output to a new vsplitted buffer

On Thursday, June 28, 2012 10:08:10 AM UTC-5, ping wrote:
> experts:
> this may be easy for experts but I'm still in beginners level...
>
> a common usage of the external program is to process texts in curr
> buffer and put it back(to replace) the texts like a pipeline - which is
> great in most circumstances.
>
> but sometime I don't want to modify my text but rather redirect the
> output to another buffer -- pretty much like what TOhtml does.
>
> particularly I want to visual select a range of text and call the
> ext-prog, then got the result in a new splitted buffer.
>
> eg. I want to visual select texts and then:
>
> :'<,'>!asciidoc -a toc -a toclevels=3 -
>
> to convert the texts into html on stdout.
>
> how to achieve that?

I first thought of this:

http://vim.wikia.com/wiki/Display_output_of_shell_commands_in_new_window

But it looks like it won't work for your purposes, because you want to use lines in the current buffer as input to the external command.

You could probably use :'<,'>w !asciidoc ...

But then you'll need to put that output into a new buffer somehow.

Probably you can :'<,'>w !asciidoc ... > somefile.html

and then load somefile.html into a new buffer.

Or maybe, asciidoc has an option to write to a file?

Anyway, the relevant help is :help :w_c

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: