" Vim syntax file " Language: ConTeXt " Maintainer: Mojca Miklavec " Installation: " To automatilcally load this file when a .tex file is opened, add the " following lines to ~/.vim/filetype.vim: " " augroup filetypedetect " au! BufRead,BufNewFile *.tex setfiletype context " augroup END " " You will have to restart vim for this to take effect. In any case it " is a good idea to read ":he new-filetype" so that you know what is going " on, and why the above lines work. " Adapted from eruby by Michael Brailsford (Thanks for the idea!) " " This is just a testing version. " TODO: " - adapt tex.vim for plain TeX + ConTeXt support only (no LaTeX!!!) " - add MetaFun support on the top of Metapost " - add all the possible \start ... \stop delimiters which switch the " syntax highlighting to MetaFun, XML, JavaScript, ... " if version < 600 syntax clear elseif exists("b:current_syntax") finish endif "Source the tex syntax file runtime! syntax/tex.vim "Set the filetype to tex to load the tex %??? ftplugins set ft=tex unlet b:current_syntax " Put the metafun syntax file in @metafunTop " " TODO: should be changed to metafun once the support is there " javascript should probably be adapted to PDF specification too, but it " changes in every version anyway and doesn't work either " syn include @metafunTop syntax/mp.vim " for some reason I can't make both metapost and javascript working at the same time "syn include @javascriptTop syntax/javascript.vim syn region metafunBlock matchgroup=metafunDelim start=#\\startMPpage# end=#\\stopMPpage# keepend contains=@metafunTop " TODO: \startuseMPgraphic{the name} - "the name" has to be catched and " typeset in ConTeXt, not in metapost!!! " \start..MP.. may not be inside comments!!! syn region metafunBlock matchgroup=metafunDelim start=#\\startMPinclusions# end=#\\stopMPinclusions# keepend contains=@metafunTop syn region metafunBlock matchgroup=metafunDelim start=#\\startMPgraphic# end=#\\stopMPgraphic# keepend contains=@metafunTop syn region metafunBlock matchgroup=metafunDelim start=#\\startuseMPgraphic# end=#\\stopuseMPgraphic# keepend contains=@metafunTop syn region metafunBlock matchgroup=metafunDelim start=#\\startreusableMPgraphic# end=#\\stopreusableMPgraphic# keepend contains=@metafunTop syn region metafunBlock matchgroup=metafunDelim start=#\\startuniqueMPgraphic# end=#\\stopuniqueMPgraphic# keepend contains=@metafunTop syn region metafunBlock matchgroup=metafunDelim start=#\\startMPrun# end=#\\stopMPrun# keepend contains=@metafunTop " comments have to be added, \startJScode{name}, "name" has to be catched and " typeset in ConTeXt, not in javascript syn region javascriptBlock matchgroup=javascriptDelim start=#\\startJScode# end=#\\stopJScode# keepend contains=@javascriptTop syn region javascriptBlock matchgroup=javascriptDelim start=#\\startJSpreamble# end=#\\stopJSpreamble# keepend contains=@javascriptTop hi link metafunDelim texSTatement hi link javascriptDelim texSTatement let b:current_syntax = "context" " vim: set ts=4 sw=4: