" Vim syntax file
" Language: Wiki MoinMoin style (see http://moin.sf.net/)

"What to do to install this file:
" $ mkdir -p ~/.vim/syntax
" $ cp wiki-moin.vim ~/.vim/syntax
" and optionally (you can set the filetype manually without it!)
" $ cat >>~/.vim/filetype.vim <<EOF
" augroup filetypedetect
" au BufNewFile,BufRead *.wiki-moin setf wiki-moin
" augroup END
" EOF
"
"If you do not already have a .vimrc with syntax on then do this:
" $ echo "syntax on" >>~/.vimrc
"
"Now every file with a filename matching *.wiki-moin will be edited
"using these definitions for syntax highlighting.

" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
  syntax clear
elseif exists("b:current_syntax")
  finish
endif

syn case match

syn match wikiName     /\/\?\(\u[a-z0-9]\+\)\{2,}/
syn match wikiName     /[^\!]\(\u[a-z0-9]\+\)\{2,}/ms=s+1
syn match wikiName     /^\w*\u\w*[a-z0-9]\w*\u\w*/
syn match wikiRule     /^-\{4,}/
syn match wikiBullet   /^\(\s\)\+\*\s/
syn match wikiNumItem  /^\(\s\)\+\d\+[.)]\s/
syn keyword wikiToDo   ToDo
syn match wikiEmail    /\S\+@\S\+\(.\S+\)*/
syn match wikiInterwiki /[a-zA-Z0-9]\+:\S\+/
syn match wikiTable    /||/
syn region wikiTableContent start="^\s*||" skip=".||." end="||$" contains=ALLBUT,wikiHead,wikiLinkDescr,wikiMeta matchgroup=wikiTable oneline
syn match wikiURL      /\(http\|https\|gopher\|mailto\|news\|ftp\|file\|wiki\|attachment\):\(\S\+\)[^|. \]]/
syn match wikiLinkNewwindow /\^/

syn region wikiHead start="^\s*=\{1,4} " end=" =\{1,4}$" oneline
syn region wikiPre start="{{{" end="}}}"
syn region wikiPre start="`" end="`" oneline
syn region wikiMacro start="\[\[" end="\]\]" oneline contains=wikiMacroParm
syn region wikiMacroParm start="(" end=")" contained
syn region wikiLink start="\[\"" end="\"\]" oneline
syn region wikiLink start="\[[^\["]" end="[^"]\]" oneline contains=wikiLinkError keepend
syn region wikiLinkError start="\["ms=s+1 end="\]"me=s-1 oneline contained contains=wikiLinkDescr,wikiURL,wikiLinkNewwindow keepend
syn region wikiLinkDescr start="\s" end="]"me=s-1 contained
syn cluster wikiInsideFormatting contains=wikiLink,wikiPre,wikiName,wikiEmail,wikiInterwiki
syn region wikiBold start="\'\{3}[^']" end="\'\{3}" contains=wikiInsideFormatting
syn region wikiItalic start="\'\{2}[^']"  end="\'\{2}" contains=wikiInsideFormatting
syn region wikiBoldItalic start="\'\{5}" end="\'\{5}" contains=wikiInsideFormatting
syn region wikiMeta start="^#" end="$" oneline

" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version <= 508 || !exists("did_wiki_syntax_inits")
  if version < 508
    let did_wiki_syntax_inits = 1
    command -nargs=+ HiLink hi link <args>
  else
    command -nargs=+ HiLink hi def link <args>
  endif

  HiLink wikiMeta      Comment
" internal links
  HiLink wikiLink      Statement
  HiLink wikiName      Statement
  HiLink wikiLinkDescr String
  HiLink wikiLinkNewwindow Statement
" external links
  HiLink wikiInterwiki Comment
  HiLink wikiURL       Underlined
  HiLink wikiEmail     Underlined
  HiLink wikiLinkError Error
" sectioning
  HiLink wikiHead      Function
  HiLink wikiBullet    Label
  HiLink wikiNumItem   Label
  HiLink wikiRule      Identifier
" highlighting
  HiLink wikiBold      Type
  HiLink wikiItalic    String
  HiLink wikiBoldItalic Comment
  HiLink wikiPre       PreProc
  HiLink wikiToDo      Todo
" table
  HiLink wikiTable     Comment
" macros
  HiLink wikiMacro     Comment
  HiLink wikiMacroParm String

  delcommand HiLink
endif

let b:current_syntax = "wiki-moin"

Vim/SyntaxHighlighting/MoinMoin (zuletzt geändert am 2007-12-23 22:45:26 durch localhost)