Attachment 'moin.vim'

Download

   1 " Vim syntax file
   2 " Language:     MoinMoin
   3 " Maintainer:   Michael Lamertz <mike@perl-ronin.de>
   4 " Contributors: David O'Callaghan <david.ocallaghan@cs.tcd.ie>
   5 "               Tony Garland <Tony.Garland@fluke.com>
   6 "               Ingo Karkat <ingo@karkat.de>
   7 " Last Change:  27-Jan-2008
   8 "   27-Jan-2008 Incorporated syntax changes of MoinMoin 1.6; the
   9 "               syntax version is configurable via g:moin_version (globally) or
  10 "               b:moin_version (for the current buffer only). 
  11 "               Small BFs: 'elsif', 'did_acedb_...'.
  12 "   22-Aug-2007 Added moinEmbedded highlighting. 
  13 "   08-May-2007 Added contains=@NoSpell for URLs, Email, pragmas and
  14 "               (configurable via g:moin_spell_wikiwords) WikiWords. 
  15 
  16 " Bugs:         Parsing of mixed bold-italic not yet implemented
  17 "               Tables not yet implemented
  18 
  19 if version < 600
  20     syntax clear
  21 elseif exists("b:current_syntax")
  22     finish
  23 endif
  24 
  25 function! s:GetMoinVersion()
  26     if exists('b:moin_version')
  27         return b:moin_version
  28     elseif exists('g:moin_version')
  29         return g:moin_version
  30     else
  31         return 999
  32     endif
  33 endfunction
  34 
  35 " headings
  36 syn match       moinHeader              /^\(=\{1,5}\).*\1$/
  37 
  38 " inline markup
  39 syn match       moinItalic              /\('\{2}\)[^']\+\1/
  40 syn match       moinBold                /\('\{3}\)[^']\+\1/
  41 syn match       moinBoldItalic          /\('\{5}\)[^']\+\1/
  42 syn match       moinUnderline           /\(_\{2}\).\{-}\1/
  43 syn match       moinSubscript           /\(,\{2}\).\{-}\1/
  44 syn match       moinSuperscript         /\(\^\).\{-}\1/
  45 syn match       moinTypewriter          /\(`\).\{-}\1/
  46 if s:GetMoinVersion() < 160
  47     syn match       moinMacro               /\[\{2}.\{-}\]\{2}/
  48 else
  49     syn match       moinMacro               /<\{2}.\{-}>\{2}/
  50 endif
  51 
  52 " Codeblocks
  53 syn region      moinPreformatted        start=/{{{/ end=/}}}/
  54 
  55 " Links
  56 if exists('g:moin_spell_wikiwords')
  57     syn match       moinWikiWord            /\(\w\+:\)\?\u[a-z0-9]\+\u[a-z0-9]\+\(\u[a-z0-9]\+\)*/
  58     syn match       moinSubLink             /\(\w\+\|\.\.\)\?\// nextgroup=moinWikiWord
  59 else
  60     syn match       moinWikiWord            /\(\w\+:\)\?\u[a-z0-9]\+\u[a-z0-9]\+\(\u[a-z0-9]\+\)*/ contains=@NoSpell
  61     syn match       moinSubLink             /\(\w\+\|\.\.\)\?\// nextgroup=moinWikiWord contains=@NoSpell
  62 endif
  63 syn match       moinNormalURL           /\w\+:\/\/\S\+/ contains=@NoSpell
  64 syn match       moinEmail               /\S\+@\S\+/ contains=@NoSpell
  65 if s:GetMoinVersion() < 160
  66     syn match       moinBracketLink         /\[[^[\]]\+\]/ contains=@NoSpell
  67     syn match       moinEmbedded            /attachment:\S\+/ contains=@NoSpell
  68     syn match       moinEmbedded            /inline:\S\+/ contains=@NoSpell
  69 else
  70     syn match       moinBracketLink         /\[\{2}.\{-}\]\{2}/ contains=@NoSpell
  71     syn match       moinEmbedded            /{\{2}[^{].\{-}}\{2}/ contains=@NoSpell
  72 endif
  73 
  74 
  75 " lists
  76 syn match       moinBulletList          /^\(\s\+\)\zs\*\ze\s/
  77 syn match       moinNumberedList        /^\(\s\+\)\zs1\.\ze\s/
  78 syn match       moinAlphalist           /^\(\s\+\)\zsa\.\ze\s/
  79 syn match       moinRomanlist           /^\(\s\+\)\zsi\.\ze\s/
  80 syn match       moinBigromanlist        /^\(\s\+\)\zsI\.\ze\s/
  81 syn match       moinDescriptionlist     /^\(\s\+\)\zs.\{-}::\ze\s/
  82 
  83 " rules
  84 syn match       moinRule                /^-\{4,}/
  85 
  86 " comments/pragmas
  87 syn match       moinComment             /^##.*$/
  88 syn match       moinPragma              /^#\w\+.*$/ contains=@NoSpell
  89 
  90 " variables
  91 syn match       moinVariable            /@\w\+@/
  92 
  93 
  94 " Define the default highlighting.
  95 " For version 5.7 and earlier: only when not done already
  96 " For version 5.8 and later: only when an item doesn't have highlighting yet
  97 if version >= 508 || !exists("did_moin_syn_inits")
  98     if version < 508
  99         let did_moin_syn_inits = 1
 100         command -nargs=+ HiLink hi link <args>
 101     else
 102         command -nargs=+ HiLink hi def link <args>
 103     endif
 104 
 105     HiLink      moinHeader              Function
 106 
 107     HiLink      moinItalic              Identifier
 108     HiLink      moinBold                Identifier
 109     HiLink      moinBoldItalic          Identifier
 110     HiLink      moinUnderline           Identifier
 111     HiLink      moinSubscript           Identifier
 112     HiLink      moinSuperscript         Identifier
 113     HiLink      moinTypewriter          Identifier
 114     HiLink      moinMacro               Define
 115     HiLink      moinPragma              Define
 116     HiLink      moinEmbedded            Include
 117 
 118     HiLink      moinPreformatted        String
 119 
 120     HiLink      moinWikiWord            Statement
 121     HiLink      moinBracketLink         Statement
 122     HiLink      moinNormalURL           Statement
 123     HiLink      moinSubLink             Statement
 124     HiLink      moinInterLink           Statement
 125     HiLink      moinEmail               Statement
 126 
 127     HiLink      moinBulletList          Type
 128     HiLink      moinNumberedList        Type
 129     HiLink      moinAlphalist           Type
 130     HiLink      moinRomanlist           Type
 131     HiLink      moinBigromanlist        Type
 132     HiLink      moinDescriptionlist     Type
 133 
 134     HiLink      moinRule                Special
 135 
 136     HiLink      moinComment             Comment
 137 
 138     HiLink      moinVariable            Macro
 139 
 140     delcommand HiLink
 141 endif
 142 
 143 let b:current_syntax = "moin"

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2008-01-27 11:06:56, 5.2 KB) [[attachment:moin.vim]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.