1 " Language: Texte Convivial Technique (TCT)
2 " License: GNU General Public License, version 3 or later (at your option)
3 " Maintainer: Julien Moutinho <julm+tct@autogeree.net>
4 " URL: http://autogeree.net/pad/edition/tct/
7 " Copy this file to ~/.vim/syntax/tct.vim
8 " then add this line to ~/.vimrc :
9 " autocmd BufNewFile,BufRead *.tct set filetype=tct
11 if exists("b:current_syntax")
20 syn match tctPlain /.\+/ contains=@tctInline
21 hi def link tctPlain Normal
24 syn match tctPath /^\( *\([^<>:=| ]*[:>]\|- \|\( *\d\+\.\)\+\)\)* *\ze\([^<>:=| ]*[>:=|@]\|-- \|- \|\( *\d\+\.\)\+\|#\+ \)/
25 \ contains=tctNodeBird,tctNodeColon,tctNodeComment,tctNodeUL,tctNodeOL
26 \ nextgroup=@tctKeyPath
27 syn cluster tctKeyPath
28 \ contains=tctKeyAt,tctKeyBird,tctKeyColon,tctKeyEqual,tctKeyBar,tctKeyComment,tctKeyUL,tctKeyOL,tctKeySection
29 syn match tctKeyAt /[^<>:=| ]*@/ contained contains=tctNodeAt nextgroup=tctValueAt
30 syn match tctKeyBar /[^<>:=| ]*|/ contained contains=tctNodeBar nextgroup=tctValueBar
31 syn match tctKeyBird /[^<>:=| ]*>/ contained contains=tctNodeBird nextgroup=tctValueBird
32 syn match tctKeyColon /[^<>:=| ]*:/ contained contains=tctNodeColon nextgroup=tctValueColon
33 syn match tctKeyEqual /[^<>:=| ]*=/ contained contains=tctNodeEqual nextgroup=tctValueEqual
34 syn match tctKeyComment /-- / contained contains=tctNodeComment nextgroup=tctValueComment
35 syn match tctKeyUL /-\ze / contained contains=tctNodeUL nextgroup=tctValueUL
36 syn match tctKeyOL /\( *\d\+\.\)\+ / contained contains=tctNodeOL nextgroup=tctValueOL
37 syn match tctKeySection /#\+\ze / contained contains=tctNodeSection nextgroup=tctValueSection
39 syn match tctNodeAt /[^<>:=| ]*@/ contained contains=tctSymAt,tctSymDot
40 syn match tctNodeBar /[^<>:=| ]*|/ contained contains=tctSymBar,tctSymDot
41 syn match tctNodeBird /[^<>:=| ]*>/ contained contains=tctSymBird,tctSymDot
42 syn match tctNodeColon /[^<>:=| ]*:/ contained contains=tctSymColon,@tctColons,tctSymDot
43 syn match tctNodeEqual /[^<>:=| ]*=/ contained contains=tctSymEqual,tctSymDot
44 syn match tctNodeComment /--/ contained
45 syn match tctNodeUL /-/ contained
46 syn match tctNodeOL /\( *\d\+\.\)\+/ contained contains=tctSymDot
47 syn match tctNodeSection /#\+/ contained
49 syn match tctSymAt /@/ contained
50 syn match tctSymBar /|/ contained
51 syn match tctSymBird />/ contained
52 syn match tctSymColon /:/ contained
53 syn match tctSymDot /[.]/ contained
54 syn match tctSymEqual /=/ contained
56 syn match tctValueAt /.*/ contained contains=@tctURL
57 syn match tctValueBar /.*/ contained
58 syn match tctValueBird /.*/ contained contains=@tctInline
59 syn match tctValueColon /.*/ contained contains=@tctInline
60 syn match tctValueEqual /.*/ contained contains=@tctInline
61 syn match tctValueComment /.*/ contained
62 syn match tctValueUL /.*/ contained contains=@tctInline
63 syn match tctValueOL /.*/ contained contains=@tctInline
64 syn match tctValueSection /.*/ contained contains=@tctInline
66 "syn match tctSection /^ *#\+ .*/ contains=@tctInline
69 hi tctNodeAt cterm=NONE ctermfg=yellow guifg=yellow
70 hi tctNodeBar cterm=NONE ctermfg=DarkYellow guifg=yellow
71 hi tctNodeBird cterm=NONE ctermfg=DarkYellow guifg=yellow
72 hi tctNodeColon cterm=bold ctermfg=yellow guifg=yellow
73 hi tctNodeEqual cterm=bold ctermfg=DarkGrey guifg=yellow
74 hi tctNodeComment cterm=bold ctermfg=DarkGrey guifg=grey
75 hi tctNodeUL cterm=bold ctermfg=yellow guifg=yellow
76 hi tctNodeOL cterm=bold ctermfg=yellow guifg=yellow
77 hi tctNodeSection cterm=bold ctermfg=magenta guifg=magenta gui=bold
79 hi tctSymAt cterm=bold ctermfg=cyan guifg=cyan
80 hi tctSymBar cterm=bold ctermfg=cyan guifg=cyan
81 hi tctSymBird cterm=bold ctermfg=cyan guifg=cyan
82 hi tctSymColon cterm=bold ctermfg=cyan guifg=cyan
83 hi tctSymDot cterm=bold ctermfg=DarkGrey guifg=grey
84 hi tctSymEqual cterm=bold ctermfg=cyan guifg=cyan
86 hi tctValueAt cterm=bold gui=bold
87 hi def link tctValueBar Normal
88 hi tctValueColon cterm=bold gui=bold
89 hi tctValueBird cterm=NONE gui=NONE
90 hi tctValueEqual cterm=NONE gui=NONE
91 hi tctValueComment ctermfg=DarkGrey cterm=bold gui=NONE guifg=grey
92 hi tctValueUL cterm=NONE gui=NONE
93 hi tctValueOL cterm=NONE gui=NONE
95 hi tctComment cterm=bold ctermfg=DarkGrey guifg=grey
96 hi tctKeySection cterm=bold ctermfg=magenta guifg=magenta gui=bold
97 hi tctValueSection cterm=bold ctermfg=magenta guifg=magenta gui=bold
100 " Semantic node names, these are not necessary but improves the view.
101 syn cluster tctColons contains=tctColonDONE,tctColonSOLVED,tctColonTODO
102 syn match tctColonDONE /\<DONE\ze:/ contained
103 syn match tctColonSOLVED /\<SOLVED\ze:/ contained
104 syn match tctColonTODO /\<TODO\ze:/ contained
105 hi tctColonDONE ctermfg=green
106 hi tctColonSOLVED ctermfg=green
107 hi tctColonTODO ctermfg=red
109 syn cluster tctBlock contains=tctPath,tctSection
113 \ /\(^\|[ `«»/"|_,.:;@^!?=~%(){}[\]\\&+-]\)\zs\*[^ *]\([^*]*[^ *]\)\?\*\ze\([ `«»/"|_,.:;@^!?=~%(){}[\]\\&+-]\|$\)/
114 \ contained contains=@tctInline
116 \ /\(^\|[ *«»/"|_,.:;@^!?=~%(){}[\]\\&+-]\)\zs`[^ `]\([^`]*[^ `]\)\?`\ze\([ *«»/"|_,.:;@^!?=~%(){}[\]\\&+-]\|$\)/
117 \ contained contains=@tctInline
119 \ /<\/\?[^ >]\+\/\?>/
120 \ contained contains=tctESym,tctEAttr
127 syn match tctQuoteFrench
129 \ contained contains=@tctInline
131 \ /\(^\|[ *`«»"'’|_,.:;@^!?=~<>%(){}[\]\\#&+-]\)\zs\/[^ /]\([^/]*[^ /]\)\?\/\ze\([ *`«»"'’|_,.:;@^!?=~<>%(){}[\]\\#&+-]\|$\)/
132 \ contained contains=@tctInline
134 \ /\(^\|[ *`«»/'’|_,.:;@^!?=~<>%(){}[\]\\#&+-]\)\zs"[^ "]\([^"]*[^ "]\)\?"\ze\([ *`«»/'’|_,.:;@^!?=~<>%(){}[\]\\#&+-]\|$\)/
135 \ contained contains=@tctInline
137 \ /\(^\|[ *`«»/"'’|_,.:;@^!?=~<>%(){}[\]\&+-]\)\zs#\([^ #]\([^#]*[^ #]\)\?#\|[^ #]*[^# *`«»/"'’|_,.:;@^!?=~<>%(){}[\]\&+-]\)\ze\([ *`«»/"'’|_,.:;@^!?=~<>%(){}[\]\&+-]\|$\)/
138 \ contained contains=@tctInline
139 syn match tctUnderline
140 \ /\(^\|[ *`«»/"'’|,.:;@!?=~<>%(){}[\]\\#&+-]\)\zs_.*_\ze\([ *`«»/"'’|,.:;@!?=~<>%(){}[\]\\#&+-]\|$\)/
141 \ contained contains=@tctInline
143 \ /[a-z+-]\+:\/\/[^| \t[\]]*\(\[[^\]]*\]\)\?/
144 \ contained contains=tctURLText
146 \ /\(\[\zs[^\]]*\ze\]\)\?/
147 \ contained contains=@tctInline
148 syn match tctEntity "&[^; \t]*;" contained contains=tctEntityPunct
149 syn match tctEntityPunct contained "[&.;]"
151 \ matchgroup=tctElem start=/<\ze[^ /!?<>"']/
152 \ matchgroup=tctElem end=/>/
153 \ contained contains=tctElemName,tctAttr,tctSymEqual,tctAttrValue
154 syn region tctElemEnd
155 \ matchgroup=tctElem start=/<\/\ze[^ /!?<>"']/
156 \ matchgroup=tctElem end=/>/
157 \ contained contains=tctElemName,tctAttrPunct
158 syn match tctNamespace
159 \ +\(<\|</\)\@2<=[^ /!?<>"':]\+\ze[:]+
161 syn match tctElemName
162 \ /\(<\|<\/\)\@2<=[^ /!?<>"']\+/
163 \ contained contains=tctNamespace,tctAttrPunct
165 \ +[-'"<]\@1<!\<[a-zA-Z:_][-.0-9a-zA-Z:_]*\>\%(['">]\@!\|$\)+
166 \ contained contains=tctAttrPunct
167 syn match tctAttrPunct +[:.]+ contained
168 syn region tctAttrValue contained start=+"+ end=+"+ contains=tctEntity
169 syn region tctAttrValue contained start=+'+ end=+'+ contains=tctEntity
172 syn cluster tctInline contains=tctBold,tctCode,tctElem,tctElemEnd,tctEntity,tctQuoteFrench,tctItalic,tctQuote,tctRef,tctUnderline,tctURL
175 hi def link tctAttr Type
176 hi def link tctAttrPunct Comment
177 hi tctBold cterm=bold gui=bold
178 hi tctCode cterm=reverse ctermfg=white gui=reverse
179 hi tctESym cterm=bold ctermfg=cyan guifg=cyan
180 hi def link tctEntity Statement
181 hi def link tctEntityPunct Type
182 hi tctItalic cterm=italic gui=italic
183 hi def link tctNamespace Tag
184 hi tctQuote cterm=bold ctermfg=cyan guifg=cyan
185 hi tctQuoteFrench cterm=bold ctermfg=green guifg=green
186 hi tctRef cterm=bold ctermfg=cyan guifg=cyan
187 hi def link tctElem Function
188 hi def link tctElemEnd Identifier
189 hi tctElemName cterm=bold ctermfg=yellow guifg=yellow
190 hi def link tctAttrValue String
191 hi def link tctTodo Todo
192 hi def link tctURL Macro
193 hi def link tctURLText tctNormal
194 hi tctUnderline cterm=underline gui=underline
196 let b:current_syntax = "tct"