Documentation update
Refactored everything to fit my use case.
Merge pull request #74 from twsh/twsh-patch-1
A small Vim plugin for previewing markdown files in a browser.
The aim of this plugin is to be light weight with minimal dependencies. Thus, there is no polling engine or webserver involved.
I forked this from JamshedVesuna/vim-markdown-preview to fit my usecase. The upstream project is essentially abandoned anyway.
vim-markdown-preview/
in .vim/bundle/
.Plugin 'JamshedVesuna/vim-markdown-preview'
to your .vimrc
.vim
and run :PluginInstall
By default, when in a .markdown
or .md
file, and Ctrl-p
is pressed, this plugin will either open a preview in your browser, or refresh your current preview (can be remapped, see Options).
Your cursor will remain in Vim.
let vim_markdown_preview_github=1
in your .vimrc
filelet vim_markdown_preview_github=1
in your .vimrc
fileIt is recommended to use grip when rendering Unicode characters.
All options have default values and work out of the box. If you prefer to change these, just add the following lines to your .vimrc file. Note that after changing an option, you have to restart Vim for the change to take effect.
vim_markdown_preview_toggle
optionThis option does two things (to be fixed by #17):
:w
)There are a total of four values (0
, 1
, 2
, 3
) this option can take.
Default: 0
, which maps Control p (not a buffer write) to generating the preview and does not display images.
Example: To display images with the hotkey mapping (defaults to Control p).
let vim_markdown_preview_toggle=1
Example: To display images automatically on buffer write.
let vim_markdown_preview_toggle=2
Example: To disregard images and still automatically preview on buffer write.
let vim_markdown_preview_toggle=3
vim_markdown_preview_hotkey
optionBy default, this plugin maps <C-p>
(Control p) to activate the preview. To remap Control p to a different hotkey, change the binding. Don't forget to add the single quotation marks.
Default: '<C-p>'
Example: Mapping Control M.
let vim_markdown_preview_hotkey='<C-m>'
vim_markdown_preview_browser
optionBy default, if you are using Unix, Google Chrome is the default browser. If you are on Mac OS X, Safari is the default. Note that bug #16 does not allow cross operating system and browser support. See the wiki page for more help.
Default: 'Google Chrome'
Example: Using Google Chrome.
let vim_markdown_preview_browser='Google Chrome'
vim_markdown_preview_temp_file
optionBy default, this plugin keeps the rendered .html
file. If you would automatically like to remove the html file after opening it in a browser, set this option to 1
. Note that removing the rendered html file with a slow browser may err.
Default: 0
Example: Remove the rendered preview.
let vim_markdown_preview_temp_file=1
vim_markdown_preview_github
optionIf you prefer GitHub flavoured markdown you need to install Python grip. Note that this makes a request to GitHub's API (causing latencies) and may require authentication. This option also requires a network connection.
Default: 0
Example: Use GitHub flavoured markdown.
let vim_markdown_preview_github=1
vim_markdown_preview_perl
optionIf you prefer to use John Gruber's Markdown.pl to render HTML, set the following flag:
Default: 0
Example: Use Markdown.pl to render HTML.
let vim_markdown_preview_perl=1
vim_markdown_preview_pandoc
optionIf you prefer to use John MacFarlane's Pandoc to render HTML, set the following flag:
Default: 0
Example: Use Pandoc to render HTML.
let vim_markdown_preview_pandoc=1
vim_markdown_preview_use_xdg_open
optionIf your system does not come with see
, and you would like to use xdg-open
to view your rendered html in the browser, set the following flag:
Default: 0
Example: Use xdg-open
.
let vim_markdown_preview_use_xdg_open=1
/tmp/
.grip
will make a call to the GitHub API and retrieve the html.