]> git.r.bdr.sh - rbdr/dotfiles/blob - vim/syntax/textile.vim
Update the stuff
[rbdr/dotfiles] / vim / syntax / textile.vim
1 "
2 " You will have to restart vim for this to take effect. In any case
3 " it is a good idea to read ":he new-filetype" so that you know what
4 " is going on, and why the above lines work.
5 "
6 " Written originally by Dominic Mitchell, Jan 2006.
7 " happygiraffe.net
8 "
9 " Modified by Aaron Bieber, May 2007.
10 " blog.aaronbieber.com
11 "
12 " Modified by Tim Harper, July 2008 - current
13 " tim.theenchanter.com
14 " @(#) $Id$
15
16 if version < 600
17 syntax clear
18 elseif exists("b:current_syntax")
19 finish
20 endif
21
22 " Textile commands like "h1" are case sensitive, AFAIK.
23 syn case match
24
25 " Textile syntax: <http://textism.com/tools/textile/>
26
27 " Inline elements.
28 syn match txtEmphasis /_[^_]\+_/
29 syn match txtBold /\*[^*]\+\*/
30 syn match txtCite /??.\+??/
31 syn match txtDeleted /-[^-]\+-/
32 syn match txtInserted /+[^+]\++/
33 syn match txtSuper /\^[^^]\+\^/
34 syn match txtSub /\~[^~]\+\~/
35 syn match txtSpan /%[^%]\+%/
36 syn match txtFootnoteRef /\[[0-9]\+]/
37 syn match txtCode /@[^@]\+@/
38
39 " Block elements.
40 syn match txtHeader /^h1\. .\+/
41 syn match txtHeader2 /^h2\. .\+/
42 syn match txtHeader3 /^h[3-6]\..\+/
43 syn match txtBlockquote /^bq\./
44 syn match txtFootnoteDef /^fn[0-9]\+\./
45 syn match txtListBullet /\v^\*+ /
46 syn match txtListBullet2 /\v^(\*\*)+ /
47 syn match txtListNumber /\v^#+ /
48 syn match txtListNumber2 /\v^(##)+ /
49
50 syn cluster txtBlockElement contains=txtHeader,txtBlockElement,txtFootnoteDef,txtListBullet,txtListNumber
51
52
53 " Everything after the first colon is from RFC 2396, with extra
54 " backslashes to keep vim happy... Original:
55 " ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
56 "
57 " Revised the pattern to exclude spaces from the URL portion of the
58 " pattern. Aaron Bieber, 2007.
59 syn match txtLink /"[^"]\+":\(\([^:\/?# ]\+\):\)\?\(\/\/\([^\/?# ]*\)\)\?\([^?# ]*\)\(?\([^# ]*\)\)\?\(#\([^ ]*\)\)\?/
60
61 syn cluster txtInlineElement contains=txtEmphasis,txtBold,txtCite,txtDeleted,txtInserted,txtSuper,txtSub,txtSpan
62
63 if version >= 508 || !exists("did_txt_syn_inits")
64 if version < 508
65 let did_txt_syn_inits = 1
66 command -nargs=+ HiLink hi link <args>
67 else
68 command -nargs=+ HiLink hi def link <args>
69 endif
70
71 HiLink txtHeader Title
72 HiLink txtHeader2 Question
73 HiLink txtHeader3 Statement
74 HiLink txtBlockquote Comment
75 HiLink txtListBullet Operator
76 HiLink txtListBullet2 Constant
77 HiLink txtListNumber Operator
78 HiLink txtListNumber2 Constant
79 HiLink txtLink String
80 HiLink txtCode Identifier
81 hi def txtEmphasis term=underline cterm=underline gui=italic
82 hi def txtBold term=bold cterm=bold gui=bold
83
84 delcommand HiLink
85 endif
86
87 " vim: set ai et sw=4 :