1" Vim syntax file 2" Language: Lout 3" Maintainer: Christian V. J. Br�ssow <[email protected]> 4" Last Change: So 12 Feb 2012 15:15:03 CET 5" Filenames: *.lout,*.lt 6" URL: http://www.cvjb.de/comp/vim/lout.vim 7 8" $Id: lout.vim,v 1.4 2012/02/12 15:16:17 bruessow Exp $ 9" 10" Lout: Basser Lout document formatting system. 11 12" Many Thanks to... 13" 14" 2012-02-12: 15" Thilo Six <T.Six at gmx dot de> send a patch for cpoptions. 16" See the discussion at http://thread.gmane.org/gmane.editors.vim.devel/32151 17 18 19" For version 5.x: Clear all syntax items 20" For version 6.x: Quit when a syntax file was already loaded 21if version < 600 22 syntax clear 23elseif exists("b:current_syntax") 24 finish 25endif 26 27let s:cpo_save=&cpo 28set cpo&vim 29 30" Lout is case sensitive 31syn case match 32 33" Synchronization, I know it is a huge number, but normal texts can be 34" _very_ long ;-) 35syn sync lines=1000 36 37" Characters allowed in keywords 38" I don't know if 128-255 are allowed in ANS-FORHT 39if version >= 600 40 setlocal iskeyword=@,48-57,.,@-@,_,192-255 41else 42 set iskeyword=@,48-57,.,@-@,_,192-255 43endif 44 45" Some special keywords 46syn keyword loutTodo contained TODO lout Lout LOUT 47syn keyword loutDefine def macro 48 49" Some big structures 50syn keyword loutKeyword @Begin @End @Figure @Tab 51syn keyword loutKeyword @Book @Doc @Document @Report 52syn keyword loutKeyword @Introduction @Abstract @Appendix 53syn keyword loutKeyword @Chapter @Section @BeginSections @EndSections 54 55" All kind of Lout keywords 56syn match loutFunction '\<@[^ \t{}]\+\>' 57 58" Braces -- Don`t edit these lines! 59syn match loutMBraces '[{}]' 60syn match loutIBraces '[{}]' 61syn match loutBBrace '[{}]' 62syn match loutBIBraces '[{}]' 63syn match loutHeads '[{}]' 64 65" Unmatched braces. 66syn match loutBraceError '}' 67 68" End of multi-line definitions, like @Document, @Report and @Book. 69syn match loutEOmlDef '^//$' 70 71" Grouping of parameters and objects. 72syn region loutObject transparent matchgroup=Delimiter start='{' matchgroup=Delimiter end='}' contains=ALLBUT,loutBraceError 73 74" The NULL object has a special meaning 75syn keyword loutNULL {} 76 77" Comments 78syn region loutComment start='\#' end='$' contains=loutTodo 79 80" Double quotes 81syn region loutSpecial start=+"+ skip=+\\\\\|\\"+ end=+"+ 82 83" ISO-LATIN-1 characters created with @Char, or Adobe symbols 84" created with @Sym 85syn match loutSymbols '@\(\(Char\)\|\(Sym\)\)\s\+[A-Za-z]\+' 86 87" Include files 88syn match loutInclude '@IncludeGraphic\s\+\k\+' 89syn region loutInclude start='@\(\(SysInclude\)\|\(IncludeGraphic\)\|\(Include\)\)\s*{' end='}' 90 91" Tags 92syn match loutTag '@\(\(Tag\)\|\(PageMark\)\|\(PageOf\)\|\(NumberOf\)\)\s\+\k\+' 93syn region loutTag start='@Tag\s*{' end='}' 94 95" Equations 96syn match loutMath '@Eq\s\+\k\+' 97syn region loutMath matchgroup=loutMBraces start='@Eq\s*{' matchgroup=loutMBraces end='}' contains=ALLBUT,loutBraceError 98" 99" Fonts 100syn match loutItalic '@I\s\+\k\+' 101syn region loutItalic matchgroup=loutIBraces start='@I\s*{' matchgroup=loutIBraces end='}' contains=ALLBUT,loutBraceError 102syn match loutBold '@B\s\+\k\+' 103syn region loutBold matchgroup=loutBBraces start='@B\s*{' matchgroup=loutBBraces end='}' contains=ALLBUT,loutBraceError 104syn match loutBoldItalic '@BI\s\+\k\+' 105syn region loutBoldItalic matchgroup=loutBIBraces start='@BI\s*{' matchgroup=loutBIBraces end='}' contains=ALLBUT,loutBraceError 106syn region loutHeadings matchgroup=loutHeads start='@\(\(Title\)\|\(Caption\)\)\s*{' matchgroup=loutHeads end='}' contains=ALLBUT,loutBraceError 107 108" Define the default highlighting. 109" For version 5.7 and earlier: only when not done already 110" For version 5.8 and later: only when an item doesn't have highlighting yet 111if version >= 508 || !exists("did_lout_syn_inits") 112 if version < 508 113 let did_lout_syn_inits = 1 114 command -nargs=+ HiLink hi link <args> 115 else 116 command -nargs=+ HiLink hi def link <args> 117 endif 118 119 " The default methods for highlighting. Can be overrriden later. 120 HiLink loutTodo Todo 121 HiLink loutDefine Define 122 HiLink loutEOmlDef Define 123 HiLink loutFunction Function 124 HiLink loutBraceError Error 125 HiLink loutNULL Special 126 HiLink loutComment Comment 127 HiLink loutSpecial Special 128 HiLink loutSymbols Character 129 HiLink loutInclude Include 130 HiLink loutKeyword Keyword 131 HiLink loutTag Tag 132 HiLink loutMath Number 133 134 " HiLink Not really needed here, but I think it is more consistent. 135 HiLink loutMBraces loutMath 136 hi loutItalic term=italic cterm=italic gui=italic 137 HiLink loutIBraces loutItalic 138 hi loutBold term=bold cterm=bold gui=bold 139 HiLink loutBBraces loutBold 140 hi loutBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic 141 HiLink loutBIBraces loutBoldItalic 142 hi loutHeadings term=bold cterm=bold guifg=indianred 143 HiLink loutHeads loutHeadings 144 145 delcommand HiLink 146endif 147 148let b:current_syntax = "lout" 149 150let &cpo=s:cpo_save 151unlet s:cpo_save 152 153" vim:ts=8:sw=4:nocindent:smartindent: 154