Skip to content

jhradilek/vim-dita

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vim-dita

Description

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.

Features

Supported document types

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

.ditamap

ditamap

Bookmap

.ditamap

ditabookmap

Topic

.dita

ditatopic

Concept

.dita

ditaconcept

Task

.dita

ditatask

Reference

.dita

ditareference

Glossary

.dita

ditaglossary

DITAVAL

.ditaval

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

Syntax highlighting

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.

Demonstration of syntax highlighting

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.

Omni completion

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.

Demonstration of omni completion

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.

Snippets

The plug-in provides a collection of snippets for each document type separately to make the content creation faster.

Demonstration of snippets

Note that the snippets are currently under development and are not complete yet. The snippets require the UltiSnips plug-in to be installed.

Compiler settings

The plug-in provides a custom compiler configuration for DITA Open Toolkit to make building previews of the content and resolving validation errors faster.

Demonstration of complier support

Note that DITA Open Toolkit needs to be installed and the dita command needs to be executable for this feature to work.

Copyright © 2024 Jaromir Hradilek

This program is free software; see the source for copying conditions. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Releases

No releases published

Packages

No packages published