how trigger vim to open a conversion result?

13 views
Skip to first unread message

meine

unread,
Nov 25, 2022, 11:37:37 AM11/25/22
to vim...@googlegroups.com
Hi,

Sometimes I get text files with a format that is not directly human
readable, e.g. an MS Word file. Does anyone know how to open a
conversion-result directly in vim?

I use pandoc to convert between formats. The string I use just to read a
Word file is

$ pandoc -f docx -t rst [file]filename[/filename] | less

Pandoc converts the docx-file to a ReStructuredText file that can be
read in a pager.

But how do I trigger vim to open the result (instead of less)?

TIA

//meine

Enan Ajmain

unread,
Nov 25, 2022, 12:26:24 PM11/25/22
to vim...@googlegroups.com
On Fri, 25 Nov 2022 17:37:26 +0100
meine <tria...@gmx.com> wrote:
> I use pandoc to convert between formats. The string I use just to
> read a Word file is
>
> $ pandoc -f docx -t rst [file]filename[/filename] | less
>
> But how do I trigger vim to open the result (instead of less)?

You can open vim with the output from stdout:

$ echo 'hello world' | vim -


--
Enan
3nan....@gmail.com
https://git.sr.ht/~enan/
https://www.github.com/3N4N

Christian Brabandt

unread,
Nov 28, 2022, 3:04:49 AM11/28/22
to vim...@googlegroups.com
Hi,
check out the various BufReadCmd autocommands. As an example, you may
want to check the zipPlugin, that is distributed with vim and allows to
browse the content of zip packages:
https://github.com/vim/vim/blob/master/runtime/plugin/zipPlugin.vim
and
https://github.com/vim/vim/blob/master/runtime/autoload/zip.vim

Best,
Chris
Reply all
Reply to author
Forward
0 new messages