attroftag1b="valueofattr1">
<childoftag1a attrofchild>
& <
</childoftag1a>
<childoftag1b attrofchild="5">
<childoftag1a>
> ' "
</childoftag1a>
</childoftag1b>
</tag1>
In the example four special elements are visible:
1. "vimxmlentities" - a special key with List containing entities of this XML
dialect.
2. If the list containing possible values of attributes has one element and
this element is equal to the name of the attribute this attribute will be
treated as boolean and inserted as "attrname" and not as 'attrname="'
3. "vimxmltaginfo" - a special key with a Dictionary containing tag
names as keys and two element List as values, for additional menu info and
the long description.
4. "vimxmlattrinfo" - special key with Dictionary containing attribute names
as keys and two element List as values, for additional menu info and long
description.
Note: Tag names in the data file MUST not contain a namespace description.
Check xsl.vim for an example.
Note: All data and functions are publicly available as global
variables/functions and can be used for personal editing functions.
DTD -> Vim *dtd2vim*
On |www| is the script |dtd2vim| which parses DTD and creates an XML data file
for Vim XML omni completion.
dtd2vim: https://www.vim.org/scripts/script.php?script_id=1462
Check the beginning of that file for usage details.
The script requires perl and:
perlSGML: https://savannah.nongnu.org/projects/perlsgml
Commands
:XMLns {name} [{namespace}] *:XMLns*
Vim has to know which data file should be used and with which namespace. For
loading of the data file and connecting data with the proper namespace use
|:XMLns| command. The first (obligatory) argument is the name of the data
(xhtml10s, xsl). The second argument is the code of namespace (h, xsl). When
used without a second argument the dialect will be used as default - without
namespace declaration. For example to use XML completion in .xsl files: >
:XMLns xhtml10s
:XMLns xsl xsl
:XMLent {name} *:XMLent*
By default entities will be completed from the data file of the default
namespace. The XMLent command should be used in case when there is no default
namespace: >
:XMLent xhtml10s
Usage
While used in this situation (after declarations from previous part, | is
cursor position): >
<|
Will complete to an appropriate XHTML tag, and in this situation: >
<xsl:|
Will complete to an appropriate XSL tag.
The script xmlcomplete.vim, provided through the |autoload| mechanism,
has the xmlcomplete#GetLastOpenTag() function which can be used in XML files
to get the name of the last open tag (b:unaryTagsStack has to be defined): >
:echo xmlcomplete#GetLastOpenTag("b:unaryTagsStack")
==============================================================================
8. Insert mode commands *inserting*
The following commands can be used to insert new text into the buffer. They
can all be undone and repeated with the "." command.
*a*
a Append text after the cursor [count] times. If the
cursor is in the first column of an empty line Insert
starts there. But not when 'virtualedit' is set!
*A*
A Append text at the end of the line [count] times.
For using "A" in Visual block mode see |v_b_A|.
<insert> or *i* *insert* *<Insert>*
i Insert text before the cursor [count] times.
When using CTRL-O in Insert mode |i_CTRL-O| the count
is not supported.
*I*
I Insert text before the first non-blank in the line
[count] times.
When the 'H' flag is present in 'cpoptions' and the
line only contains blanks, insert start just before
the last blank.
For using "I" in Visual block mode see |v_b_I|.
*gI*
gI Insert text in column 1 [count] times.
*gi*
gi Insert text in the same position as where Insert mode
was stopped last time in the current buffer.