-
-
Save thinca/134975 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 | |
let b:hatena_syntax_super_pre_loaded = {} " Reset when load. | |
function! s:update_super_pre() | |
let mx = '^>|\zs.*\ze|$' | |
for curline in getline(1, '$') | |
let ft = matchstr(curline, mx) | |
if ft != '' && !has_key(b:hatena_syntax_super_pre_loaded, ft) | |
\ && globpath(&rtp, 'syntax/' . ft . '.vim') != '' | |
unlet! b:current_syntax | |
let save_isk= &l:isk " For scheme. | |
execute printf('syntax include @hatenaSuperPre_%s syntax/%s.vim', | |
\ ft, ft) | |
let &l:isk= save_isk | |
execute printf('syntax region hatenaSuperPre ' | |
\ . 'matchgroup=hatenaBlockDelimiter start="^>|%s|$" end="^||<$" ' | |
\ . 'contains=@hatenaSuperPre_%s', ft, ft) | |
let b:hatena_syntax_super_pre_loaded[ft] = 1 | |
end | |
endfor | |
" workaround for perl | |
syn cluster HatenaSuperPre_perl remove=perlFunctionName | |
endfunction | |
command! -buffer -bar HatenaSuperPreUpdate call s:update_super_pre() | |
HatenaSuperPreUpdate | |
" Optional. Append the following if you need. | |
augroup syntax-hatena-superpre | |
autocmd! | |
autocmd CursorHold,CursorHoldI * HatenaSuperPreUpdate | |
augroup END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment