Ⅰ. 插件描述
Convert current file to colored HTML, BBCode or whateverⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/formatvim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/formatvim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/formatvim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/formatvim
Ⅳ. 文档说明
This plugin provides the ability to convert current file to colored HTML,
BBcode, (in future) LaTeX or whatever you have written specification for.
Features:
∙ Flexible format specifications.
∙ Ability to create abstract stylesheets.
∙ 'list' [1] and 'listchars' [2] options support (only tab, trail, eol and conceal
for now).
∙ Side-by-side diffs support. format-side-by-side-diff [3]
∙ Support for creating numbered lines.
∙ Dynamic folds support. g:format_AllFolds [4]
Differencies with built-in :TOhtml [5]:
∙ For large files formatting using my plugin is faster.
∙ 'list' [1] and 'listchars' [2] options support.
∙ Background color for the whole line with differencies, not just for text
(for g:html_no_pre [6]=1) and without trailing spaces (for
g:html_no_pre [6]=0).
∙ Signs support. signs [7]
∙ Tags linked to their definition. Implemented for 2html in
vimscript #2252. g:format_IgnoreTags [8]
∙ (HTML) Anchors in tags definition location: for copying links.
g:format_HTMLAddLinkAtTagLine [9]
∙ Side-by-side diff based on tables (2html relies on lines having the same
height which is generally false).
∙ Full conceal support: with g:format_FormatConcealed [10] set to 2
formats-format-html generates both concealed and shown.
∙ Non-copyable signs, fold columns and numbers by default. 2html requires
setting g:html_prevent_copy [11].
∙ 'fillchars' [12] vert suboption support (2html supports only diff and fold
suboptions).
∙ Matches and 'hlsearch' [13] support. g:format_FormatMatches [14]
∙ More correct highlighting in some cases.
∙ Support for formats other then HTML/XHTML (format-formats [15]). Makes it
relatively easy to add new format to the list of supported formats
(format-f-format.add [16]).
∙ 2html still has more options for HTML formatting though.
∙ Full 'foldcolumn' [17] support: 2html sets foldcolumn to either 'foldcolumn' [17]
value or maximum fold level, whichever is greater, formatvim uses
'foldcolumn' [17] value, fully emulating what vim shows.
∙ 'spell' [18] checking support. g:format_IgnoreSpell [19]
Plugin requires some additional plugins:
∙ frawor (https://bitbucket.org/ZyX_I/frawor)
Note: formatvim supports VAM (https://github.com/MarcWeber/vim-addon-manager).
It is prefered that you use it for formatvim installation.
Project page: https://bitbucket.org/ZyX_I/formatvim
Documentation: http://vimcommunity.bitbucket.org/doc/format.txt.html
[1] http://vimcommunity.bitbucket.org/doc/options.txt.html#.27list.27
[2] http://vimcommunity.bitbucket.org/doc/options.txt.html#.27listchars.27
[3] http://vimcommunity.bitbucket.org/doc/format.txt.html#format-side-by-side-diff
[4] http://vimcommunity.bitbucket.org/doc/format.txt.html#g.3aformat_AllFolds
[5] http://vimcommunity.bitbucket.org/doc/syntax.txt.html#.3aTOhtml
[6] http://vimcommunity.bitbucket.org/doc/syntax.txt.html#g.3ahtml_no_pre
[7] http://vimcommunity.bitbucket.org/doc/sign.txt.html#signs
[8] http://vimcommunity.bitbucket.org/doc/format.txt.html#g.3aformat_IgnoreTags
[9] http://vimcommunity.bitbucket.org/doc/format.txt.html#g.3aformat_HTMLAddLinkAtTagLine
[10] http://vimcommunity.bitbucket.org/doc/format.txt.html#g.3aformat_FormatConcealed
[11] http://vimcommunity.bitbucket.org/doc/syntax.txt.html#g.3ahtml_prevent_copy
[12] http://vimcommunity.bitbucket.org/doc/options.txt.html#.27fillchars.27
[13] http://vimcommunity.bitbucket.org/doc/options.txt.html#.27hlsearch.27
[14] http://vimcommunity.bitbucket.org/doc/format.txt.html#g.3aformat_FormatMatches
[15] http://vimcommunity.bitbucket.org/doc/format.txt.html#format-formats
[16] http://vimcommunity.bitbucket.org/doc/format.txt.html#format-f-format.2eadd
[17] http://vimcommunity.bitbucket.org/doc/options.txt.html#.27foldcolumn.27
[18] http://vimcommunity.bitbucket.org/doc/options.txt.html#.27spell.27
[19] http://vimcommunity.bitbucket.org/doc/format.txt.html#g.3aformat_IgnoreSpell