Ⅰ. 插件描述
Live preview markdown in Chrome using applescriptⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'neoclide/macdown-vim-hard-things'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'neoclide/macdown-vim-hard-things'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'neoclide/macdown-vim-hard-things'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/neoclide/macdown.vim
Ⅳ. 文档说明
# Macdown.vim
A simplified and flexible markdown preview for vim user on Mac.
Using applescript instead of a server to enhance the exprience of live preview.
You can get the style preview here
Features
- No server, much better performance.
- Async markdown parse when possible (using jobstart of nvim/vim or vimproc)
- Works out of box, all dependencies are optional.
- Preview in Chrome with range and auto reload support.
- Auto close Chrome tab on buffer delete and vim exit.
- Tables, GFM enabled, code highlight and footnote enabled by default.
- Misaka parser support smartypants,
- (table of content) and unicode (including Emoji)
Install
Take vundle as example:
Plugin 'chemzqm/macdown.vim'
Usage
To preview current markdown file, type:
:Preview
Preview with range, eg:
:1,10Preview
Or visual select a range, and use:
:'<,'>Preview
To toggle auto preview for current file, type:
:PreviewAuto
The corresponding chrome tab would be activated and refreshed on TextChanged and
TextChangedI. A handy remap could be:
nnoremap <C-p> :PreviewAuto<CR>
Configuration
By default macdown.vim using markit for
markdown parsing, it's exists inside this repository, but if you need speed and
more future, you can set global variable:
let g:macdown_marked_programme = 'misaka'
To enable misaka parse, it's almost 4 times faster than markit, but you need to
install python dependencies:
pip install misaka pygments
sudo might be required.
You can also make your own parser, just create a excutable file that
accepts markdown content from stdin and output html to stdout, then
configure g:macdown_external_programme to the path of the file:
let g:macdown_external_programme = '~/my-parser'
TODO
- Scrollbind for vim and Chrome (vim doesn't support Scroll autocmd, bind
CurseMove would be rediculious for me)