My dotfiles. Period.

tracwiki.vim 4.5KB

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