File: haskell.vim

package info (click to toggle)
haskell-haddock 2.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 932 kB
  • sloc: haskell: 6,792; xml: 1,630; yacc: 121; makefile: 14; sh: 1
file content (68 lines) | stat: -rw-r--r-- 2,836 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
" Attempt to add haddock highlighting for haskell comments
" It should be placed in ~/.vim/after/syntax/haskell.vim
" Brad Bowman <haddock.vim@bereft.net>

syn match   hsHdocChunk "$\i\+" contained
syn match   hsHdocMod /"\(\i\|[.]\)\+"/ contained
syn match   hsHdocLink "'\(\i\|[.#]\)\+'" contained
syn region  hsHdocAnchor start="\\\@<!#" skip="\\#" end="\\\@<!#" contained oneline
" I think emphasis can span multiple lines
syn region  hsHdocEm start="\\\@<!/" skip="\\/" end="\\\@!/" contained oneline
syn region  hsHdocURL start="\\\@<!<" end="\\\@<!>" contained oneline
syn region  hsHdocCode start="\\\@<!@" skip="\\@" end="\\\@<!@" contained oneline
syn region  hsHdocBCodeBlock start="^@\(\s\|$\)" end="^@\s*$" contained
syn region  hsHdocLCodeBlock start="\(^\s*--\s*\)\@<=@\s*$" end="\(^\s*--\s*\)\@<=@\s*$" contained
syn match   hsHdocBHeading "^\s*\*\+" contained
syn match   hsHdocLHeading "\(^\s*--\s*\)\@<=\*\+" contained
syn match   hsHdocBTracks "^\s*>" contained
" match only the > using a look-behind
syn match   hsHdocLTracks "\(^\s*--\s*\)\@<=>" contained

" todo: numbered lists, mark haddock start separately
"syn match   hsHdocStart "\([$^|]\|\*\+\)" contained

syn cluster hsHdocSpecial 
  \ contains=hsHdocMod,hsHdocLink,hsHdocEm,hsHdocCode,hsHdocURL,
  \ hsHdocAnchor,hsHdocChunk

syn region  hsHdocDef start="^\s*\(--\)\?\s*\[" end="\]" contained contains=hsHdocSpecial

syn region  hsHdocLines start="--\s*\([$\^|]\|\*\+\)" 
                      \ skip="^\s*\(--.*\)$" 
                      \ end="^\s*\(\$\|--\)\@!" 
                      \ contains=@hsHdocSpecial,hsHdocLTracks,hsHdocLHeading,hsHdocLCodeBlock,hsHdocDef
syn region  hsHdocBlock start="{-\s*\([$\^|]\|\*\+\)" end="-}" 
                      \ contains=@hsHdocSpecial,hsHdocBTracks,hsHdocBHeading,hsHdocBCodeBlock,hsHdocDef

syn sync minlines=20

if version >= 508 || !exists("did_haddock_syntax_inits")
  if version < 508
    let did_haddock_syntax_inits = 1
    command -nargs=+ HiLink hi link <args>
  else
    command -nargs=+ HiLink hi def link <args>
  endif

  HiLink hsHdocLines            hsHdoc
  HiLink hsHdocBlock            hsHdoc
  HiLink hsHdoc                 PreProc
  HiLink hsHdocAnchor           Special
  HiLink hsHdocChunk            Special
  HiLink hsHdocMod              Special
  HiLink hsHdocLink             Special
  HiLink hsHdocEm               Special
  HiLink hsHdocURL              Special
  HiLink hsHdocCode             Special
  HiLink hsHdocLHeading         Special
  HiLink hsHdocBHeading         Special
  HiLink hsHdocLTracks          Special
  HiLink hsHdocBTracks          Special
  HiLink hsHdocBCodeBlock       Special
  HiLink hsHdocLCodeBlock       Special
  HiLink hsHdocSpecial          Special

  delcommand HiLink                       
endif

" Options for vi: sw=2 sts=2 nowrap ft=vim