VIM 7.3.46
J'ai un fichier de syntaxe personnalisé défini pour rendre mes notes plus lisibles.
Je veux définir une gamme qui appliquera la mise en surbrillance de syntaxe à partir d'un fichier de syntaxe existant (p. Ex. Php, javascript ou autre) dans certains caractères aux limites.
Par exemple,
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**
Je cherche donc quelque chose comme ça pour mettre le fichier de syntaxe 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
Mais il ne faut appliquer que la mise en surbrillance javascript au texte dans la plage définie:
Les lignes requises sont les suivantes:
" 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