VIM 7.3.46
我定义了一个自定义语法文件,以使我的便笺更具可读性。
我想定义一个范围,该范围将在某些边界字符内应用现有语法文件(例如php,javascript或其他)中的语法突出显示。
例如,
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**
所以我正在寻找这样的东西放入vim语法文件中:
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
但是它只能将javascript突出显示应用于定义范围内的文本:
所需的行如下:
" Include PHP highlighting between **phpbegin** and **phpend** tags
syn include @notesPHP syntax/php.vim
syn region phpCustom start=+\*\*phpbegin\*\*+ keepend end=+\*\*phpend\*\*+ contains=@notesPHP
" Include JavaScript highlighting between **jsbegin** and **jsend** tags
syn include @notesJavaScript syntax/javascript.vim
syn region javaScriptCustom start=+\*\*jsbegin\*\*+ keepend end=+\*\*jsend\*\*+me=s-1 contains=@nJavaScript
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句