Most of the time when I’m working on a Markdown document like a README, I want to preview it in Chrome as markdown. Perhaps I’m working on an HTML document and want to preview it in Chrome. It would be a real pain to go to Chrome and then look for the file I’m working on. Luckily Vim makes this really easy.
Add this to your .vimrc
" Open up current file in chrome nmap <silent> <leader>ch :exec 'silent !open -a "Google Chrome" % &'
(Optional) Add a Markdown viewer to Chrome. I use Markdown Preview Plus.
Now in Vim you just need to enter these commands in Normal mode (hint: my
That’s all there is to this. It allows you to simply open the current file in Chrome.
Did this help you out? It took me a few days to piece together all this information together, I hope this saves you some time (who knows, maybe the future me will be thankful I wrote this down). Let me know your thoughts. email@example.com