]> git.r.bdr.sh - rbdr/dotfiles/blame - vim/syntax/textile.vim
Ignore logs, stuff
[rbdr/dotfiles] / vim / syntax / textile.vim
CommitLineData
0d23b6e5
BB
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
16if version < 600
17 syntax clear
18elseif exists("b:current_syntax")
19 finish
20endif
21
22" Textile commands like "h1" are case sensitive, AFAIK.
23syn case match
24
25" Textile syntax: <http://textism.com/tools/textile/>
26
27" Inline elements.
28syn match txtEmphasis /_[^_]\+_/
29syn match txtBold /\*[^*]\+\*/
30syn match txtCite /??.\+??/
31syn match txtDeleted /-[^-]\+-/
32syn match txtInserted /+[^+]\++/
33syn match txtSuper /\^[^^]\+\^/
34syn match txtSub /\~[^~]\+\~/
35syn match txtSpan /%[^%]\+%/
36syn match txtFootnoteRef /\[[0-9]\+]/
37syn match txtCode /@[^@]\+@/
38
39" Block elements.
40syn match txtHeader /^h1\. .\+/
41syn match txtHeader2 /^h2\. .\+/
42syn match txtHeader3 /^h[3-6]\..\+/
43syn match txtBlockquote /^bq\./
44syn match txtFootnoteDef /^fn[0-9]\+\./
45syn match txtListBullet /\v^\*+ /
46syn match txtListBullet2 /\v^(\*\*)+ /
47syn match txtListNumber /\v^#+ /
48syn match txtListNumber2 /\v^(##)+ /
49
50syn 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.
59syn match txtLink /"[^"]\+":\(\([^:\/?# ]\+\):\)\?\(\/\/\([^\/?# ]*\)\)\?\([^?# ]*\)\(?\([^# ]*\)\)\?\(#\([^ ]*\)\)\?/
60
61syn cluster txtInlineElement contains=txtEmphasis,txtBold,txtCite,txtDeleted,txtInserted,txtSuper,txtSub,txtSpan
62
63if 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
85endif
86
87" vim: set ai et sw=4 :