dotfiles / vim / syntax / lecnote.vim

Full commit
" Vim syntax file
" Language:     Lecture notes
" Maintainer:   Jonas Höglund <firefly@firefly․nu>
" Filenames:    *.lecnote
" Last Change:  2012-09-16

if exists("b:current_syntax")

"runtime! syntax/markdown.vim
"unlet! b:current_syntax

syn sync minlines=8

"""" Borrow stuff from markdown... """"""""""""""""""""""""""""""""""
syn cluster markdownBlock contains=markdownHeading

" Altered: allow leading whitespace.
syn match   markdownHeading        "^.\+\n\s*=\+$"  contains=markdownHeadingRule
syn match   markdownHeading        "^.\+\n\s*-\+$"  contains=markdownHeadingRule
syn match   markdownHeadingRule    "^\s*[=-]\+$"   contained

syn region  markdownHeading        matchgroup=markdownHeadingRule
\           start="^\s*#\+" end="#*\s*$"  oneline

hi def link markdownHeading          Title
hi def link markdownHeadingRule      PreProc

" Altered: +oneline, concealends
"syn region  markdownItalic         matchgroup=Conceal concealends oneline
"\           start="\S\@<=\*\|\*\S\@="      end="\S\@<=\*\|\*\S\@="
"syn region  markdownBold           matchgroup=Conceal concealends oneline
"\           start="\S\@<=\*\*\|\*\*\S\@="  end="\S\@<=\*\*\|\*\*\S\@="

"""" Foreign-syntax blocks  """""""""""""""""""""""""""""""""""""""""
" The general definition of a foreign-block
syn region  lectureForeignBlock        matchgroup=Ignore  keepend
\           start="{{{\?"              end="}}}\?"  contains=@lectureForeignBlocks

" vim-modeline foreign block (de-emphasizes the modeline)
syn region  lectureModelineBlock       keepend  matchgroup=Ignore
\           start="{{{\?\s*vim:"      end="}}}\?"
hi def link lectureModelineBlock       Ignore

" Logic proofs
syn include @logicImport               syntax/lecnote-sub/logic.vim
syn region  lectureLogicBlock          keepend  matchgroup=Ignore
\           start="{{{\?\s*logic"      end="}}}\?"  contains=@logicImport

" Linear algebra
syn include @linalgImport              syntax/lecnote-sub/linalg.vim
syn region  lectureLinalgBlock         keepend  matchgroup=Ignore
\           start="{{{\?\s*linalg"     end="}}}\?"  contains=@linalgImport

"""" General-purpose formatting """""""""""""""""""""""""""""""""""""
"syn match   lectureProperty        "^\s*[A-ZÅÄÖa-zåäö0-9_*]\+: "
"\           contains=markdownItalic,markdownBold

"syn region  lectureUnderline       matchgroup=Conceal concealends oneline
"\           start="\S\@<=_\|_\S\@="        end="\S\@<=_\|_\S\@="

syn match   lectureListMarker      "^\s*[-+*]\+ \@="
syn match   lectureListMarker      "^\s*\%([a-z]\|[0-9.]\+\)\+[).:] \@="

hi def link lectureListMarker      Function

let b:current_syntax = "lecnote"