Previewing Markdown files with Marked and Vim
I’ve been tinkering with Vimwiki again. It happens.
While editing Markdown files, I often want to see a preview of the file as HTML. This is where Brett Terpstra’s Marked comes in handy.
I didn’t know the best way to start previewing a file directly from Vim to Marked. A quick search turned up this post by Rob Allen showing how to use Vim’s
make command to open the current file in Marked.
It’s easy. In ~/.vim/ftplugin/markdown.vim, I added the following line…
set makeprg=open\ -a\ Marked\\\ 2.app\ ‘%:p
Now, when editing any Markdown file I just type
:make and that file opens in Marked. Neat.
Originally published at baty.net on December 15, 2016.