Ⅰ. 插件描述
A HTML viewer built for vim. Useful to see output of Pandoc or MarkdownⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'lambdalisue/shareboard-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'lambdalisue/shareboard-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'lambdalisue/shareboard-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/lambdalisue/shareboard.vim
Ⅳ. 文档说明
shareboard.vim
Version: 0.1.5rc4
shareboard.vim is a HTML preview software for vim inspired by [mkdpreview-vim][].

Quick Usage
See Packages to install in Arch Linux.
Install [Pandoc][] with
**Windows & Mac OS X** There is a package installer at pandoc's [download page](http://code.google.com/p/pandoc/downloads/list) **Linux** Try your package manager such as `apt-get`, `yum` or `rpm` See http://johnmacfarlane.net/pandoc/installing.html for more detailInstall [Shareboard][] with
**Windows** Use [easy_install][] to install Shareboard. See http://packages.python.org/distribute/easy_install.html for more detail $ easy_install shareboard **Mac OS X & Linux** Use [pip][] or [easy_install][] to install Shareboard. You may need to use `sudo`. $ pip install shareboard After that, **you have to install [Qt][] and [PySide][] to enable shareboard viewer**Confirm Pandoc and Shareboard are correctly installed with command below
$ pandoc --help $ shareboard --helpCreate
helloworld.mdand write some Markdown, type<Leader>vto showShareboard viewer
Require
- Python
[Shareboard][]
- [Qt][]
- [PySide][]
- [Pandoc][] (Reqiured if you want to use as default settings)
Install
shareboard.vim use [Shareboard][] to display the preview, so you have to install
it with the commands below
$ pip install shareboard
And also, you have to install [Qt][] and [PySide][] to enable shareboard
builtin HTML viewer.
After you install Shareboard, you can install shareboard.vim with [vim-pathogen][]
, [vundle][] or simply copy the files into your .vim directory
And also, if you want to use shareboard.vim with [Markdown][],
[reStructuredText][], or [Textile][] file, you need to install [Pandoc][] to
convert these types of files into HTML file.
If you want to use different programs to convert files such as [Markdown.pl][],
you can change g:shareboard_command variable.
Usage
In default, shareboard.vim activate two key mappings in following file type
- Html
- Markdown
- reStructuredText
- Textile
The key mappings activated are
<Leader>v
Show the preview window. After you show the preview window, the preview
will automatically be updated when you save the file with :w command
<Leader>c
Compile the data with command specified in g:shareboard_command
Configure
Variables
g:shareboard_path
Specify the path of Shareboard. Default is shareboard
g:shareboard_host
Specify the host name of Shareboard server. Default is localhost
g:shareboard_port
Specify the port number of Shareboard server. Default is 8081
g:shareboard_command
Specify the compile command. Default is pandoc -Ss --webtex -t html
g:shareboard_compile_ext
Specify the ext name of compiled file. Default is .html
Functions
ShareboardStart
Start Shareboard server with specified settings. It also execute
ShareboardUpdate
Update Shareboard with the current buffer. The Shareboard must be exected
before.
ShareboardPreview
Call ShareboardStart and ShareboardUpdate
ShareboardCompile
Compile current buffer with specified settings.
Key mappings
<Leader>v
Show the preview window. After you show the preview window, the preview
will automatically be updated when you save the file with :w command
<Leader>c
Compile the data with command specified in g:shareboard_command
Advanced usage
Custom arguments
[Pandoc][] can use custom arguments such as custom CSS or Bibliography.
In shareboard.vim, you can simply apply these custom argument withg:shareboard_command like
let g:shareboard_command = printf('pandoc -sS --toc --webtex -c "%s" --bibliography="%s"',
\ expand("~/.vim/shareboard/main.css"),
\ expand("~/.vim/shareboard/library.bib"))
See http://johnmacfarlane.net/pandoc/demos.html to find available arguments.
Replace text before Pandoc
shareboard.vim use a command specified with g:shareboard_command so you can
simply apply Shell script to this variable to modify the text before passing it
to the Pandoc like
let g:shareboard_command = expand("~/.vim/shareboard/command.sh")
# ~/.vim/shareboard/command.sh
#!/usr/bin/env bash
CSS="~/.vim/shareboard/main.css"
BIB="~/.vim/shareboard/library.bib"
TEXT=`cat /dev/stdin`
# Replace [0-9] u[mMgl] -> [0-9] μ[mMgl] (e.g. 10 ul -> 10 μl)
TEXT=`echo "$TEXT" | sed 's/\([0-9]\) u\([mMgl]\)/\1 \μ\2/g'
# Replace &celsius; -> °C
TEXT=`echo "$TEXT" | sed 's/\&celsius;/\°C/g'
# See the link below to all replacement I daily use.
# https://github.com/lambdalisue/dotfiles/blob/master/vim/shareboard/command.sh
# Convert with Pandoc
TEXT=`echo "$TEXT" | pandoc -sS --toc --webtex -c "$CSS" --bibliography="$BIB" 2>/dev/null`
# return
echo "$TEXT"
With this command.sh, shareboard.vim will preview the text below to the screenshot below.
A sample advanced usage
=======================================
To transfect a DNA into *E. coli*, you need to follow the steps below.
1. Thaw 50 ul of TSS cells in 0.5 ml tube on ice
2. Add 1-10 ul of DNA, pipette gently to mix
3. Incubate the cell for 30 min on ice and set 0.5 ml tube incubator at 42 C while waiting
4. Incubate the cell for 30-60 sec at 42 C and immediately put on ice for 2 min
5. Transfer all TSS cells to 1-2 ml of SOC at RT
6. Incubate the cells at 37 C for 1 hour on shaker
7. Spread 100-300 ul of cells onto a appropriate antibiotic plate. Grow overnight at 37 C
Note that the custom CSS is applied, all units are replaced with appropriate character and all C replaced with degree Celsius.

Packages
Currently packages of shareboard.vim and [Shareboard][] are available in only
Arch Linux
Arch Linux (Thank Anntoin)