Version: 0.1.5rc4
shareboard.vim is a HTML preview software for vim inspired by mkdpreview-vim.
See Packages to install in Arch Linux.
Install Pandoc with
Windows & Mac OS X There is a package installer at pandoc's download page
Linux
Try your package manager such as apt-get
, yum
or rpm
See http://johnmacfarlane.net/pandoc/installing.html for more detail
Install 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 --help
Create helloworld.md
and write some Markdown, type <Leader>v
to show
Shareboard viewer
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.
In default, shareboard.vim activate two key mappings in following file type
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
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
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.
<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
Pandoc can use custom arguments such as custom CSS or Bibliography.
In shareboard.vim, you can simply apply these custom argument with
g: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.
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.
Currently packages of shareboard.vim and Shareboard are available in only Arch Linux
Arch Linux (Thank Anntoin)