Ⅰ. 插件描述
Extends xmledit package to provide schema-specific attribute callbacks easilyⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/xml-cbks'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/xml-cbks'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/xml-cbks'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/xml_cbks
Ⅳ. 文档说明
This script extends the functionality of the excellent xmledit plugin.
xmledit gives you a single global callback for inserting attributes,
XmlAttribCallback. The suggestion is that this method will dispatch based
on which tag is received. The script provides a hook that will set the
variable b:xml_doctype when loaded (via the function XmlFindDocType). Then
it provides a generic XmlAttribCallback which does the following:
1. Looks for a file called $VIMXMLEDITCALLBACKS/{b:xml_doctype}.vim
2. If that file exists and hasn't already been loaded, it is sourced
This file is expected to provide a function called
XmlAttribCallback_{b:xml_doctype}. This function is called if it exists,
passing the xml_tag as the argument.
The intent is so that you can have a different callback for each doctype (schema) which will automatically be available when you edit an XML file of a
specified type. The plugin also provides a way to provide any doctype
specific functionality automatically (you can put anything in the sourced
script). It is almost like a secondary ftplugin for xml.
Note: This is my first vim script (I've been using vim for less than 3 weeks) so any suggestions for improvement are very welcome.