Since I’ve moved back to using vim+tmux in the terminal for virtually all my writing and code editing (and gotten faster in a number of respects), one of the key things I’ve missed from Sublime Text 3 has been its excellent and speedy markdown preview in Chrome.
It was a friction point in moving back to terminal vim since an old plugin I’d used before was no longer available, and the fallback I’d had to render Github-flavoured markdown was to use a combination of Tim Pope’s Dispatch and the octodown gem. It had a number of issues, one of which was the time it took to shell out and then render the preview, but more than that, it just seemed to slow everything down.
In any case, one of our senior engineers already had a nice alternative, which also had the added advantage of live previews on saved changes. Pretty simply, he used a Chrome extension, Markdown Reader (make sure you tick on the option for accessing File URLs, or it can’t access local files).
I riffed on his solution slightly, after previewing a few different markdown previewers, and ended up using the excellent Markview instead since you get the nice TOC that you get with Markdown Reader, a nice copy-paste that will go into GMail’s Compose window nicely, the GH-flavoured markdown and syntax highlighting for fenced code blocks which comes in very handy (again, make sure you tick the option in Extensions for accessing file URLs or it can’t preview local markdown files.)..
Then it’s a simple matter of connecting that to a simple open command in my
command MarkdownPreview !open -a "Google Chrome" "%" map <silent><C-m> :MarkdownPreview<cr><cr>
On my OSX system, this creates the
MarkdownPreview command which is then
linked to the
Ctrl-m combination for easy launching (nb: The second
after the command seems to be the easiest way to auto-enter for the
Press ENTER or type command to continue prompt you get after executing an external command
and returning to the vim screen you’d want to see immediately.).
It is quite fast and my only real complaint was wishing that Markdown Reader supported github-favoured markdown and the default Github (or generally nicer) stylesheet as well as syntax highlighting for code blocks.
Switching to Markview (which I do think is better in every way) fixed that easily enough which takes care of everything but supporting GHF Task lists (which the very responsive author of Markview just kindly updated to work on 2015-06-15 from my request.).
In any case, handy timesaver and very speedy. In fact, I’m using it to preview this writing right now before posting. =]