Last active
August 29, 2015 14:14
-
-
Save lcw/0e51e72072d6741287ef 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
" ******** Syntax highlighting | |
if has("syntax") | |
syntax clear | |
source $VIMRUNTIME/syntax/fortran.vim | |
function! TextEnableCodeSnip(filetype,start,end,textSnipHl) abort | |
let ft=toupper(a:filetype) | |
let group='textGroup'.ft | |
if exists('b:current_syntax') | |
let s:current_syntax=b:current_syntax | |
" Remove current syntax definition, as some syntax files (e.g. cpp.vim) | |
" do nothing if b:current_syntax is defined. | |
unlet b:current_syntax | |
endif | |
execute 'syntax include @'.group.' syntax/'.a:filetype.'.vim' | |
try | |
execute 'syntax include @'.group.' after/syntax/'.a:filetype.'.vim' | |
catch | |
endtry | |
if exists('s:current_syntax') | |
let b:current_syntax=s:current_syntax | |
else | |
unlet b:current_syntax | |
endif | |
execute 'syntax region textSnip'.ft.' | |
\ matchgroup='.a:textSnipHl.' | |
\ start="'.a:start.'" end="'.a:end.'" | |
\ containedin=ALL | |
\ contains=@'.group.'' | |
endfunction | |
call TextEnableCodeSnip('python','$loopy begin transform','loopy end transform', 'Comment') | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put this file in ~/.vim/after/syntax