~dricottone/vim-markdown-preview

ae4d0347c1e55f52138495420a1197919eab0eb4 — JamshedVesuna 9 years ago ec7ef63
Updated README to show image support; Added new screenshot
2 files changed, 25 insertions(+), 6 deletions(-)

M README.md
A images/screenshot-with-images.gif
M README.md => README.md +25 -6
@@ 1,7 1,9 @@
Vim Markdown Preview
====================

A Vim plugin for previewing markdown files in a browser. This plugin was designed to maintain focus on vim but use Google Chrome or Safari to preview rendered markdown. Thus, everything is done in the background so you never have to leave Vim.
A Vim plugin for previewing markdown files in a browser. This plugin was designed to maintain focus on Vim but use Google Chrome or Safari to preview rendered markdown. Thus, everything is done in the background so you never have to leave Vim.

The aim of this plugin is to be light weight with minimal dependencies. Thus, there is no polling engine or webserver involved.

![Screenshot](images/screenshot.gif?raw=true "Screenshot")



@@ 29,17 31,34 @@ Support and Requirements

Usage
=====
When in a *.markdown or *.md file, vim-markdown-preview does the following when you type `Ctrl-p` (can be remapped):
When in a *.markdown or *.md file, vim-markdown-preview does the following when you type `Ctrl-p` (can be remapped, see below):

* If you are not previewing the current file:
    * Open an html rendered version of your file in Google Chrome or Safari in the background.
* Otherwise:
    * Refresh your preview of the current markdown file in Google Chrome or Safari.

Uncomment the last line in `plugin/vim-markdown-preview.vim` to map a buffer write to the above instead of `Ctrl-p`.
## Remapping Hotkeys
Please recomment current mapping if you chose to use another mapping.

* Map to buffer write:
    * Uncomment the [last line of](https://github.com/JamshedVesuna/vim-markdown-preview/blob/master/plugin/vim-markdown-preview.vim#L110) `plugin/vim-markdown-preview.vim`
* Map to buffer write and enable image viewing:
    * Uncomment the [fourth to last line](https://github.com/JamshedVesuna/vim-markdown-preview/blob/master/plugin/vim-markdown-preview.vim#L107) of `plugin/vim-markdown-preview.vim`
* Map `Ctrl-p` to view images:
    * Uncomment the [seventh to last line](https://github.com/JamshedVesuna/vim-markdown-preview/blob/master/plugin/vim-markdown-preview.vim#L104) in `plugin/vim-markdown-preview.vim`.

The following example is using the write buffer option on OS X, with displaying images in the markdown preview:

![Screenshot](images/screenshot-with-images.gif?raw=true "Screenshot With Images")

Behind The Scenes
=================
1. First, vim-markdown-preview renders your markdown as html and creates a temporary file `vim-markdown-preview.html` in `/tmp/`.
2. Next, vim-markdown-preview then either opens the html file or refreshes the Google Chrome or Safari tab.
3. If you would like vim-markdown-preview to remove the temporary file so nothing left behind, set `REMOVE_TEMP_FILE` to 1.
* Regular mapping:
    1. First, vim-markdown-preview renders your markdown as html and creates a temporary file `vim-markdown-preview.html` in `/tmp/`.
    2. Next, vim-markdown-preview either opens the html file or refreshes the Google Chrome or Safari tab.
    3. If you would like vim-markdown-preview to remove the temporary file so nothing left behind, set `REMOVE_TEMP_FILE` to 1.
* Image viewing:
    1. First, vim-markdown-preview renders your markdown as html with the filename `<your-file>.md.html` in the same directory.
    2. Next, vim-markdown-preview either opens the html file or refreshes the Google Chrome or Safari tab.
    3. There is currently no option to remove this file after previewing.

A images/screenshot-with-images.gif => images/screenshot-with-images.gif +0 -0