2 " Language: Ikiwiki (links)
3 " Maintainer: Recai OktaĆ¾ (roktasATdebian.org)
4 " Last Change: 2007 May 29
7 " - make sure to use the relevant syntax file which can be found
8 " at vim.org; below are the syntax files for markdown and reST,
10 " http://www.vim.org/scripts/script.php?script_id=1242
11 " http://www.vim.org/scripts/script.php?script_id=973
12 " - put the file into your syntax directory (e.g. ~/.vim/syntax)
13 " - if you use markdown (with .mdwn extension) add sth like below
14 " in your VIM startup file:
15 " au BufNewFile,BufRead *.mdwn set ft=ikiwiki
16 " - if you use a different markup other than markdown (e.g. reST)
17 " make sure to setup 'g:ikiwiki_render_filetype' properly in
18 " your startup file (skip this step for mkd.vim, it should work
21 " - revamp the whole file so as to detect valid ikiwiki directives
22 " and parameters (needs a serious work)
27 " Load the base syntax (default to markdown) if nothing was loaded.
28 if !exists("b:current_syntax")
29 let s:ikiwiki_render_filetype = "mkd"
30 if exists("g:ikiwiki_render_filetype")
31 let s:ikiwiki_render_filetype = g:ikiwiki_render_filetype
33 exe 'runtime! syntax/' . s:ikiwiki_render_filetype . '.vim'
36 unlet b:current_syntax
40 syn region ikiwikiLinkContent matchgroup=ikiwikiLink start=+\[\[\(\w\+\s\+\)\{,1}+ end=+\]\]+ contains=ikiwikiLinkNested,ikiwikiParam,ikiwikiNoParam
41 syn region ikiwikiLinkNested matchgroup=ikiwikiLinkNested start=+"""+ end=+"""+ contains=ikiwikiLinkContent contained
43 " FIXME: Below is an ugly hack to prevent highlighting of simple links
44 " as directives. Links with spaces are still problematic though.
45 syn region ikiwikiNoParam start=+\[\[[^|=]\+|+ end=+[^|=]\+\]\]+ keepend contains=ikiwikiMagic,ikiwikiDelim
47 syn match ikiwikiDelim "\(\[\[\|\]\]\)" contained
48 syn match ikiwikiMagic "|" contained
49 syn match ikiwikiParam "\<\i\+\ze=" nextgroup=ikiwikiParamAssign contained
50 syn match ikiwikiParamAssign "=" nextgroup=ikiwikiValue contained
51 syn region ikiwikiValue start=+"[^"]+hs=e-1 end=+[^"]"+ skip=+\\"+ keepend contains=ikiwikiValueMagic,ikiwikiDelim contained
52 syn match ikiwikiValueMagic +\(!\<\|\*\|\<\(and\|or\)\>\|\<\i*(\|\>)\)+ contained
56 hi def link ikiwikiLink Statement
57 hi def link ikiwikiLinkNested String
58 hi def link ikiwikiLinkContent Underlined
60 hi def link ikiwikiMagic Operator
61 hi def link ikiwikiDelim Operator
62 hi def link ikiwikiNoParam Underlined
63 hi def link ikiwikiParam Identifier
64 hi def link ikiwikiParamAssign Operator
65 hi def link ikiwikiValue String
66 hi def link ikiwikiValueMagic Type
68 let b:current_syntax = "ikiwiki"