• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

JamshedVesuna/vim-markdown-preview: A light Vim plugin for previewing markdown f ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

JamshedVesuna/vim-markdown-preview

开源软件地址(OpenSource Url):

https://github.com/JamshedVesuna/vim-markdown-preview

开源编程语言(OpenSource Language):

Vim Script 100.0%

开源软件介绍(OpenSource Introduction):

Vim Markdown Preview

Intro

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.

Screenshot

Installation

  • With Pathogen: Place vim-markdown-preview/ in .vim/bundle/.
  • With Vundle:
    • Add Plugin 'JamshedVesuna/vim-markdown-preview' to your .vimrc.
    • Launch vim and run :PluginInstall

See more Options.

Usage

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.

Requirements

Mac OS X:

Unix:

It is recommended to use grip when rendering Unicode characters.

Options

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.

The vim_markdown_preview_toggle option

This option does two things (to be fixed by #17):

  1. Display images in the preview
  2. Generate preview on buffer write (Example: on :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

The vim_markdown_preview_hotkey option

By 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>'

The vim_markdown_preview_browser option

By 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'

The vim_markdown_preview_temp_file option

By 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

The vim_markdown_preview_github option

If 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

The vim_markdown_preview_perl option

If 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

The vim_markdown_preview_pandoc option

If 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

The vim_markdown_preview_use_xdg_open option

If 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

Behind The Scenes

  1. First, this plugin renders your markdown as html and creates a temporary html file.
  2. Next, this plugin either opens the html file or refreshes the Google Chrome or Safari tab.
    • If you are using GitHub flavoured markdown, grip will make a call to the GitHub API and retrieve the html.
  3. Lastly, if you choose, this plugin will remove the temporary file.



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap