Created
June 6, 2019 16:53
-
-
Save wcooley/1c15def2fc864312641e93b3c49c74c1 to your computer and use it in GitHub Desktop.
Vim support for BeanShell-in-XML rules for SailPoint IIQ; also, example setting syntax for region of language embedded within CDATA structures in XML
This file contains hidden or 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
" | |
" Place in ~/.vim/after/syntax/xml.vim | |
" | |
" This enables Java syntax highlighting for the BeanShell embedded within CDATA | |
" regions of rule XML for Sailpoint IIQ. | |
" | |
" There might be better ways to limit loading this syntax than looking in the | |
" first 5 lines for 'language="beanshell"', but I cannot figure out how and this | |
" works for now. | |
" | |
" There is no BeanShell syntax definition included with Vim, so Java will have | |
" to do. | |
" | |
if match(getline(0,5), 'language="beanshell"') != -1 | |
if exists("b:current_syntax") | |
let s:current_syntax = b:current_syntax | |
unlet b:current_syntax | |
endif | |
syn include @BEANSHELL syntax/java.vim | |
syn region BeanShellCode | |
\ matchgroup=xmlCdataStart start="<!\[CDATA\["rs=e | |
\ matchgroup=xmlCdataEnd end="]\]>"re=s | |
\ contains=@BEANSHELL,xmlCdataStart,xmlCdataEnd | |
\ fold | |
syn cluster xmlCdataHook add=BeanShellCode | |
syn sync fromstart | |
let b:current_syntax = s:current_syntax | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment