├── README.adoc ├── ftdetect └── asciidoc.vim └── syntax └── asciidoc.vim /README.adoc: -------------------------------------------------------------------------------- 1 | *NOTE*: Development of the Vim asciidoc syntax highlighting place completely in the http://github.com/vim/vim/[vim repository]. As such, this repository has been archived for historical purposes. 2 | 3 | = AsciiDoc syntax support for Vim 4 | 5 | This is the development version of Vim's included syntax highlighting and filetype plugins for AsciiDoc. 6 | Generally you don't need to install these if you are running a recent version of Vim. 7 | 8 | == Overview 9 | 10 | Syntax highlighting is incredibly useful. 11 | In addition to making reading AsciiDoc documents much easier, syntax highlighting also helps you catch AsciiDoc syntax errors as you write your documents. 12 | 13 | This repository contains the Vim files necessary to syntax highlight AsciiDoc in Vim. 14 | A stable version of these files is included in the Vim distribution (see https://github.com/vim/vim/blob/master/runtime/syntax/asciidoc.vim[]). 15 | 16 | == Installation (development files) 17 | 18 | Install the highlighter by copying `asciidoc.vim` to your `$HOME/.vim/syntax` directory. 19 | 20 | NOTE: Create this directory if it doesn't already exist. 21 | 22 | You can enable syntax highlighing in one of the following ways: 23 | 24 | . Put a Vim _autocmd_ in your Vim configuration file 25 | . Execute the Vim command `:set syntax=asciidoc` 26 | . Add the following line to the end of you AsciiDoc source files: 27 | 28 | // vim: set syntax=asciidoc: 29 | 30 | == License 31 | 32 | Copyright (C) The AsciiDoc Project. 33 | Distributed under the same terms as Vim itself. 34 | See `:help license` inside Vim. 35 | -------------------------------------------------------------------------------- /ftdetect/asciidoc.vim: -------------------------------------------------------------------------------- 1 | autocmd BufNewFile,BufRead *.asciidoc,*.adoc 2 | \ set ft=asciidoc 3 | -------------------------------------------------------------------------------- /syntax/asciidoc.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: AsciiDoc 3 | " Author: Stuart Rackham (inspired by Felix 4 | " Obenhuber's original asciidoc.vim script). 5 | " URL: http://asciidoc.org/ 6 | " Licence: GPL (http://www.gnu.org) 7 | " Remarks: Vim 6 or greater 8 | " Limitations: 9 | " 10 | " - Nested quoted text formatting is highlighted according to the outer 11 | " format. 12 | " - If a closing Example Block delimiter may be mistaken for a title 13 | " underline. A workaround is to insert a blank line before the closing 14 | " delimiter. 15 | " - Lines within a paragraph starting with equals characters are 16 | " highlighted as single-line titles. 17 | " - Lines within a paragraph beginning with a period are highlighted as 18 | " block titles. 19 | 20 | 21 | if exists("b:current_syntax") 22 | finish 23 | endif 24 | 25 | syn clear 26 | syn sync fromstart 27 | syn sync linebreaks=100 28 | 29 | " Run :help syn-priority to review syntax matching priority. 30 | syn keyword asciidocToDo TODO FIXME CHECK TEST XXX ZZZ DEPRECATED 31 | syn match asciidocBackslash /\\/ 32 | syn region asciidocIdMarker start=/^\$Id:\s/ end=/\s\$$/ 33 | syn match asciidocCallout /\\\@/ 34 | syn match asciidocOpenBlockDelimiter /^--$/ 35 | syn match asciidocLineBreak /[ \t]+$/ containedin=asciidocList 36 | syn match asciidocRuler /^'\{3,}$/ 37 | syn match asciidocPagebreak /^<\{3,}$/ 38 | syn match asciidocEntityRef /\\\@\?[0-9A-Za-z_]\@!/ 42 | syn match asciidocAttributeRef /\\\@.]\{,3}\)\?\([a-z]\)\?\)\?|/ containedin=asciidocTableBlock contained 85 | syn region asciidocTableBlock matchgroup=asciidocTableDelimiter start=/^|=\{3,}$/ end=/^|=\{3,}$/ keepend contains=ALL 86 | syn match asciidocTablePrefix /\(\S\@.]\{,3}\)\?\([a-z]\)\?\)\?!/ containedin=asciidocTableBlock contained 87 | syn region asciidocTableBlock2 matchgroup=asciidocTableDelimiter2 start=/^!=\{3,}$/ end=/^!=\{3,}$/ keepend contains=ALL 88 | 89 | syn match asciidocListContinuation /^+$/ 90 | syn region asciidocLiteralBlock start=/^\.\{4,}$/ end=/^\.\{4,}$/ contains=asciidocCallout,asciidocToDo keepend 91 | syn region asciidocListingBlock start=/^-\{4,}$/ end=/^-\{4,}$/ contains=asciidocCallout,asciidocToDo keepend 92 | syn region asciidocCommentBlock start="^/\{4,}$" end="^/\{4,}$" contains=asciidocToDo 93 | syn region asciidocPassthroughBlock start="^+\{4,}$" end="^+\{4,}$" 94 | 95 | " Allowing leading \w characters in the filter delimiter is to accomodate 96 | " the pre version 8.2.7 syntax and may be removed in future releases. 97 | syn region asciidocFilterBlock start=/^\w*\~\{4,}$/ end=/^\w*\~\{4,}$/ 98 | 99 | syn region asciidocMacroAttributes matchgroup=asciidocRefMacro start=/\\\@>\)\|^$/ contains=asciidocQuoted.* keepend 100 | syn region asciidocMacroAttributes matchgroup=asciidocAnchorMacro start=/\\\@