Quantcast
Channel: User Hubro - Stack Overflow
Viewing all articles
Browse latest Browse all 45

Answer by Hubro for Is there a Vim plugin for previewing markdown files?

$
0
0

I recently found a Chrome extension that makes Chrome able to properly open and display markdown files: Markdown preview (no longer available, you can use Markdown Preview Plus now).

Then it was just a matter of mapping a key in Vim to open the file with Chrome. Mine looks like this:

" Open markdown files with Chrome.autocmd BufEnter *.md exe 'noremap <F5> :!start C:\Users\tomas\AppData\Local\Google\Chrome\Application\chrome.exe %:p<CR>'

This command would have to be edited, of course, if your files don't have the ".md" extension, you want your mapping on a different key or if Chrome is located at a different location.

Now whenever I'm editing a ".md" file I can hit <F5> to open the file in Chrome. A perfect solution would be to get Chrome to auto reload every few seconds, but I can't seem to find an such an extension that works for local files.


Pros:

  • The ability to hit a button to preview your markdown file, without the need for any running servers or special code.
  • Works on all platforms that supports Vim and Chrome - which pretty much covers all platforms.

Cons:

  • No auto-refresh, you have to hit <F5> every time you want to preview the file.
  • No Github-flavoured markdown.

Viewing all articles
Browse latest Browse all 45

Trending Articles