4
1
VIM 7.3.46
I have a custom syntax file defined for making my notes more readable.
I want to define a range that will apply syntax highlighting from an existing syntax file (e.g. php, javascript or whatever) within certain boundary characters.
For example,
Notes.txt
Notes would be here, blah blah...
More notes, then a javascript code block with proper js highlighting below this:
**jsbegin**
$('#jquerystuff').change(function(){
var example = $(this).val();
alert(example);
});
**jsend**
So I'm looking for something like this to put in the vim syntax file:
so <sfile>:p:h/javascript.vim
so <sfile>:p:h/php.vim
syn region notesJS matchgroup=javascript start="**jsbegin**" end="**jsend**" contains=javascript
syn region notesPHP matchgroup=php start="**phpbegin**" end="**phpend**" contains=php
But it must only apply javascript highlighting to text within the defined range:
I think me=s-1 means the highligh region is before jsend. Then can I use
start=+\*\*jsbegin\*\*+ms=e+1
? I tried it but jsbegin is still highlighted in JavaScript syntax. – Gqqnbig – 2015-07-20T23:45:17.810@LoveRight did you ever solve this? I'm having the same issue. – Azsgy – 2017-07-30T16:36:57.660