I installed bnf.vim (highlights BNF grammar files).
Suppose I have a comment in my code:
/*
:= | h
:= a | b |
My use case was highlighting an inline Lambda function in a CloudFormation template. Using the above-mentioned SyntaxRange plugin, I added this to my .vimrc
:
autocmd Syntax * call SyntaxRange#Include('vim: set ft=js:','vim: set ft=js:','javascript')
And then in my template:
Function:
Type: AWS::Lambda::Function
Properties:
FunctionName: myFunction
Code:
ZipFile:
!Sub |
// vim: set ft=js:
const aws = require('aws-sdk');
const aws4 = require('aws4');
const https = require('https');
const zlib = require('zlib');
...
// vim: set ft=js:
# vim: set ft=yaml: