|
@@ -0,0 +1,114 @@
|
|
1
|
+" Vim syntax file for Trac wiki syntax
|
|
2
|
+"
|
|
3
|
+" Language: trac wiki
|
|
4
|
+" Maintainer: Caleb Constantine <cadamantine@gmail.com>
|
|
5
|
+" Last Change: 22 Nov 2010
|
|
6
|
+" Version: 0.5
|
|
7
|
+
|
|
8
|
+" Modified extensively from wiki.vim, by Andreas Kneib,
|
|
9
|
+" http://www.vim.org/scripts/script.php?script_id=725
|
|
10
|
+
|
|
11
|
+" To use this syntax file:
|
|
12
|
+"
|
|
13
|
+" - Put the file in your syntax directory, e.g. ~/.vim/syntax,
|
|
14
|
+" $HOME/vimfiles/syntax (see :help syntax).
|
|
15
|
+" - Enable file type detection. One method is to add the following to your
|
|
16
|
+" filetype.vim file, which is usually located in ~/.vim or $HOME/vimfiles
|
|
17
|
+" (create it if not present, see :help filetype):
|
|
18
|
+"
|
|
19
|
+" augroup tracwiki
|
|
20
|
+" au! BufRead,BufNewFile *.tracwiki setfiletype tracwiki
|
|
21
|
+" augroup END
|
|
22
|
+"
|
|
23
|
+" TODO:
|
|
24
|
+" - Highlight tables.
|
|
25
|
+" - Highlight Blockquotes
|
|
26
|
+" - Highlight Numbered (ordered) lists
|
|
27
|
+" - Highlight Processors. Some processors can have there own syntax highlight,
|
|
28
|
+" e.g. rst. Pull in syntax for these from existing syntax files.
|
|
29
|
+" - Some wiki formatting is allowed inside discussion citations
|
|
30
|
+" (tracDisussion). We don't currently support that but we should.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+" Quit if syntax file is already loaded
|
|
34
|
+if version < 600
|
|
35
|
+ syntax clear
|
|
36
|
+elseif exists("b:current_syntax")
|
|
37
|
+ finish
|
|
38
|
+endif
|
|
39
|
+
|
|
40
|
+syn region tracVerb start="{\{3}" end="}\{3}"
|
|
41
|
+syn region tracVerb start="`" end="`"
|
|
42
|
+
|
|
43
|
+syn region tracHead start="^=\{1,5} " end="=\{1,5} *\(#[^ ]\+\)\?"
|
|
44
|
+syn match tracLine "^----$"
|
|
45
|
+
|
|
46
|
+syn region tracItalic start=+''+ end=+''+ containedin=tracHead contains=tracEscape
|
|
47
|
+syn region tracBold start=+'''+ end=+'''+ containedin=tracHead contains=tracEscape
|
|
48
|
+syn region tracBoldItalic start=+'''''+ end=+'''''+ containedin=tracHead contains=tracEscape
|
|
49
|
+syn region tracUnderline start=+__+hs=s+2 end=+__+he=e-2 containedin=tracHead contains=tracEscape
|
|
50
|
+syn region tracStrike start=+\~\~+ end=+\~\~+ containedin=tracHead contains=tracEscape
|
|
51
|
+syn region tracSuper start=+\^+ end=+\^+ containedin=tracHead contains=tracEscape
|
|
52
|
+syn region tracSub start=+,,+ end=+,,+ containedin=tracHead contains=tracEscape
|
|
53
|
+
|
|
54
|
+" This may need to be fine tuned.
|
|
55
|
+syn match tracEscape "![^ ]\+\( \|$\)" contained
|
|
56
|
+syn region tracEscape start=+!\[+ end=+\]+
|
|
57
|
+
|
|
58
|
+syn region tracLink start=+\[+ end=+\]+
|
|
59
|
+syn match tracRawLink "\<\%(\%(\%(https\=\|file\|ftp\|gopher\)://\|\%(mailto\|news\):\)[^[:space:]'\"<>]\+\|www[[:alnum:]_-]*\.[[:alnum:]_-]\+\.[^[:space:]'\"<>]\+\)[[:alnum:]/]" contains=@NoSpell
|
|
60
|
+syn match tracPageName "\<\(wiki:\)\?\([A-Z][a-z]\+\)\{2,}\>\([#/]\<\([A-Z][a-z]\+\)\{2,}\>\)*"
|
|
61
|
+
|
|
62
|
+" Trac links
|
|
63
|
+"
|
|
64
|
+" Tickets
|
|
65
|
+syn match tracLinks "#\d\+"
|
|
66
|
+" Reports
|
|
67
|
+syn match tracLinks "{\d\+}"
|
|
68
|
+" Change sets. Make sure defined after tracLink otherwise syntax will break.
|
|
69
|
+syn match tracLinks "\<r\d\+"
|
|
70
|
+" Revision log. Make sure defined after tracLink otherwise syntax will break.
|
|
71
|
+syn match tracLinks "\<r\d\+:\d\+"
|
|
72
|
+syn match tracLinks "\[\d\+:\d\+\(/[^]]\+\)*\]"
|
|
73
|
+" General form, type:id (where id represents the number, name or path of the
|
|
74
|
+" item)
|
|
75
|
+syn match tracLinks `\<\(wiki\|source\|attachment\|milestone\|diff\|log\|report\|changeset\|comment\|ticket\):\(".\+"\|'.\+'\|\(\S\+\)\+\)`
|
|
76
|
+
|
|
77
|
+" Change sets. Make sure defined after tracLink and before tracLinks otherwise
|
|
78
|
+" syntax will break.
|
|
79
|
+syn region tracMacro start=+\[\[+ end=+\]\]+
|
|
80
|
+
|
|
81
|
+syn match tracListItem "^\s\+[*-]\s\+"
|
|
82
|
+syn match tracDefList "^\s.\+::"
|
|
83
|
+
|
|
84
|
+syn region tracDisussion start="^>" end="$"
|
|
85
|
+
|
|
86
|
+syn match tracEscape "!\<\([A-Z][a-z]\+\)\{2,}\>\([#/]\<\([A-Z][a-z]\+\)\{2,}\>\)*"
|
|
87
|
+
|
|
88
|
+" The default highlighting.
|
|
89
|
+
|
|
90
|
+hi def link tracLinks Function
|
|
91
|
+hi def link tracHead Type
|
|
92
|
+hi def link tracLine Type
|
|
93
|
+hi def link tracVerb String
|
|
94
|
+hi def tracBold term=bold cterm=bold gui=bold
|
|
95
|
+hi def tracItalic term=italic cterm=italic gui=italic
|
|
96
|
+hi def tracUnderline term=underline cterm=underline gui=underline
|
|
97
|
+hi def tracBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic
|
|
98
|
+hi def link tracEscape Special
|
|
99
|
+hi def link tracStrike Statement
|
|
100
|
+hi def link tracSuper Statement
|
|
101
|
+hi def link tracSub Statement
|
|
102
|
+hi def link tracLink Function
|
|
103
|
+hi def link tracRawLink Function
|
|
104
|
+hi def link tracPageName Function
|
|
105
|
+hi def link tracListItem Operator
|
|
106
|
+hi def link tracDefList tracBoldItalic
|
|
107
|
+hi def link tracMacro PreProc
|
|
108
|
+hi def link tracDisussion Comment
|
|
109
|
+
|
|
110
|
+hi def link tracCurlyError Error
|
|
111
|
+
|
|
112
|
+let b:current_syntax = "trac"
|
|
113
|
+
|
|
114
|
+"vim: tw=78:ft=vim:ts=8
|