Created
January 16, 2009 02:45
-
-
Save mattn/47777 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" append to syntax/hatena.vim | |
function SyntaxSuperPre() | |
let lnum = 1 | |
let lmax = line("$") | |
let mx = '^>|\(.*\)|$' | |
while lnum <= lmax | |
let curline = getline(lnum) | |
if curline =~ mx | |
let lang = substitute(curline, mx, '\1', '') | |
exec 'runtime! syntax/'.lang.'.vim' | |
unlet b:current_syntax | |
let syntaxfile = fnameescape(substitute(globpath(&rtp, 'syntax/'.lang.'.vim'), '[\r\n].*$', '', '')) | |
if len(syntaxfile) | |
exec 'syntax include @inline_'.lang.' '.syntaxfile | |
exec 'syn region hatenaSuperPre matchgroup=hatenaBlockDelimiter start=+^>|'.lang.'|$+ end=+^||<$+ contains=@inline_'.lang | |
endif | |
end | |
let lnum = lnum + 1 | |
endwhile | |
" workaround for perl | |
syn cluster inline_perl remove=perlFunctionName | |
endfunction | |
call SyntaxSuperPre() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment