The vim-dita plug-in adds support for Darwin Information Typing Architecture (DITA) version 1.3 to Vim. It provides file type detection for DITA files, as well as syntax highlighting and omni completion for DITA maps and topics according to the official specification.
The following are currently supported DITA document types and their corresponding filetype
settings in Vim.
DITA document type | Expected file extension | Vim filetype setting |
---|---|---|
Map |
|
|
Bookmap |
|
|
Topic |
|
|
Concept |
|
|
Task |
|
|
Reference |
|
|
Glossary |
|
|
DITAVAL |
|
|
File type settings marked with the dagger symbol † are used by default for the selected file extension if the DOCTYPE
directive can not be found on the first three lines of the file. To switch to a different file type manually, use the following Vim command:
:set ft=file_type
The plug-in provides syntax highlighting for each document type separately to ensure that otherwise valid DITA elements are not highlighted for document types that do not allow them.
Note that the plug-in only checks that the element is allowed in the particular document type, not whether it is used in the correct place. The visual distinction between valid and invalid elements also depends on the color scheme you use.
The plug-in provides contextual completion based on the DITA specification. When completing an element name, it allows you to cycle through elements that are valid children of the element your are in, when completing attribute names, it only offers attributes that are valid for that specific element, and if attribute values are limited to a list of possible values, it only offers you those values.
Note that the plug-in only checks whether the element is a valid child of its parent, not whether it is used in the right order or the correct number of times.
By default, the key combination for omni completion is set to Ctrl+x Ctrl+o
. To cycle through the list of available options forwards, press Ctrl+n
, to cycle through the list backwords, press Ctrl+p
.
The plug-in provides a collection of snippets for each document type separately to make the content creation faster.
Note that the snippets are currently under development and are not complete yet. The snippets require the UltiSnips plug-in to be installed.
The plug-in provides a custom compiler configuration for DITA Open Toolkit to make building previews of the content and resolving validation errors faster.
Note that DITA Open Toolkit needs to be installed and the dita
command needs to be executable for this feature to work.