Ⅰ. 插件描述
blockdiag series with VimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'mhaig/vim-blockdiag-series'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'mhaig/vim-blockdiag-series'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'mhaig/vim-blockdiag-series'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/mhaig/vim-blockdiag-series
Ⅳ. 文档说明
# vim-blockdiag-series
vim-blockdiag-series provides syntax highlighting and compiler plugin for blockdiag series in Vim.
blockdiag series include blockdiag, seqdiag, actdiag, nwdiag and rackdiag.
If you need automatic filetype detection, add some settings to ~/.vim/scripts.vim on *nix
or vimfiles/scripts.vim on Windows
(For details, :help new-filetype in Vim).
One example is as follows.
if did_filetype()
finish
endif
let s:line1 = getline(1)
"" blockdiag series
if s:line1 =~ '\<diagram\|blockdiag\>\s*{'
setfiletype blockdiag
elseif s:line1 =~ '\<seqdiag\>\s*{'
setfiletype seqdiag
elseif s:line1 =~ '\<actdiag\>\s*{'
setfiletype actdiag
elseif s:line1 =~ '\<nwdiag\>\s*{'
setfiletype nwdiag
elseif s:line1 =~ '\<rackdiag\>\s*{'
setfiletype rackdiag
elseif s:line1 =~ '\<packetdiag\>\s*{'
setfiletype packetdiag
endif
unlet s:line1For instance, when you write
nwdiag {at the top line of your files, Vim sets filetype=nwdiag.
However, note that in this setting Vim doesn't check all lines except the first line,
so you fail the filetype detection even if the above directive line is described
in the second or subsequent line of your files.