~dricottone/vim-markdown-preview

906c7a8f843747878b8ec2da262a57218f1661c1 — Jamshed Vesuna 10 years ago
Initial commit
2 files changed, 29 insertions(+), 0 deletions(-)

A README.md
A plugin/vim-markdown-preview.vim
A  => README.md +16 -0
@@ 1,16 @@
Vim Markdown Preview
====================

Vim plugin for previewing markdown files in a browser.

Installation
============

1. With Pathogen: Place `vim-markdown-preview/` in `.vim/bundle/`

Usage
=====

* When the current buffer is *.markdown or *.md, Vim Markdown Preview maps `Ctrl-p` to open the buffer in the default system browser as html.
* Vim Markdown Preview creates a temporary file vim-markdown-preview.html in /tmp/ and removes it after opening it in a browser so nothing is left behind.
* Further, Vim Markdown Preview opens the browser in the background, which allows you to maintain focus on vim.

A  => plugin/vim-markdown-preview.vim +13 -0
@@ 1,13 @@
"============================================================
"                    Vim Markdown Preview
"   git@github.com:JamshedVesuna/vim-markdown-preview.git
"============================================================

function! Vim_Markdown_Preview()
  :let curr_file = expand('%:t')
  :call system('markdown ' . curr_file . ' > /tmp/vim-markdown-preview.html' . ' && open -g /tmp/vim-markdown-preview.html')
  :sleep 314m
  :call system('rm /tmp/vim-markdown-preview.html')
endfunction

autocmd Filetype markdown,md map <buffer> <C-p> :call Vim_Markdown_Preview()<CR>