vim and editing pandoc2rfc

June 16, 2013


… or any other document format for that matter.

I thought it might be nice to have some sort of split window view in that allows you to edit a Pandoc file on the left and see the generated I-D on the right (in vim, with no extra daemons and not relying on inotify).

Turns out you can do that, though it is not optimal, but it works. The jury is still out if this works well enough to actually make it useful.

In the following example we work on the file README.mkd and the output file is draft.txt. With this incantation, we vertical split the window and set one buffer readonly (for the output file draft.txt), For the first buffer we add an autocommand that runs make whenever we save the buffer.

vim -O README.mkd draft.txt -c 'buf 2' -c 'setl readonly' \
-c 'setl autoread' -c 'buf 1' \
-c 'au BufWritePost <buffer> make draft.txt'  

For added effect you could run :windo set scrollbind, but I didn’t find that work particularly well.

The following images show how it looks: first on startup, then we make a change and save the file and the we see the result.

start vim in vertical split mode

make a change

see the result