~dricottone/vim-markdown-preview

ref: 07977025917f90f270d4c1581e6970d4c0ab1a29 vim-markdown-preview/README.md -rw-r--r-- 3.3 KiB
07977025 — Jamshed Vesuna Merge pull request #10 from gmerzu/master 9 years ago

#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.

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

Screenshot

#Installation

  1. With Pathogen: Place vim-markdown-preview/ in .vim/bundle/.
  2. Default browsers:
  3. Defaults to keeping rendered .html file

#Support and Requirements

#OS X:

#Unix:

#Usage

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.

#Remapping Hotkeys

Please recomment current mapping if you chose to use another mapping.

  • Map to buffer write:
    • Uncomment the last line of plugin/vim-markdown-preview.vim
  • Map to buffer write and enable image viewing:
  • Map Ctrl-p to view images:

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

Screenshot

#Behind The Scenes

  • 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.