I use this for identifying *.cfn.json
and *.cfn.yml
files as JSON and YAML format cloudformation templates.
Their filetypes are set to cfn_json
and cfn_yaml
respectively. I can then have custom highlighting of key attributes
and/or custom snippets set up that are not polluting my editor when I am working with straight javascript/yaml intended
for other purposes. This in on mac os x after installing vim 7.3 along with vim-snipmate and vim-snippets plugins. Someone feel free to improve on this.
au BufRead,BufNewFile *.cfn.json set ft=cfn_json
au BufRead,BufNewFile *.cfn.yml set ft=cfn_yaml
au BufRead,BufNewFile *.cfn.yaml set ft=cfn_yaml
mkdir -p ~/.vim/ftplugin
mkdir -p ~/.vim/syntax
# cloudformation json
cp /usr/share/vim/vim73/ftplugin/javascript.vim ~/.vim/ftplugin/cfn_json.vim
cp /usr/share/vim/vim73/syntax/javascript.vim ~/.vim/syntax/cfn_json.vim
# cloudformation yaml
cp /usr/share/vim/vim73/ftplugin/yaml.vim ~/.vim/ftplugin/cfn_yaml.vim
cp /usr/share/vim/vim73/syntax/yaml.vim ~/.vim/syntax/cfn_yaml.vim
- Top-level
- skeleton: outputs a basic skeleton of a cloudformation template
- param: outputs a snippet for an input parameter element
- meta: outputs a snippet for a metadata element
- map: outputs a snippet for a mapping element
- cond: outputs a snippet for a condition element
- rsrc: outputs a snippet for a resource element
- out: outputs a snippet for an output element
- functions
- ref: ouputs a shorthand
Ref
fn snippet - gat: ouputs a shorthand
GetAtt
fn snippet - sub: outputs a shorthand
Sub
fn snippet - sub+: outputs a shorthand
Sub
fn snippet for a multiline string - join: Outputs a shorthand
Join
fn snippet - ==: outputs a shorthand
Equals
expression - !=: outputs a shorthand
Not
expression - if: outputs a shorthand
If
statement - fim: outputs a shorthand
FindInMap
expression
- ref: ouputs a shorthand
- resources
- lconfig: Outputs an
AWS::AutoScaling::LaunchConfiguration
snippet - asg: Outputs an
AWS::AutoScaling::AutoScalingGroup
snippet - role: Outputs an
AWS::IAM::Role
snippet - policy: Outputs a policy snippet for an
AWS::IAM::Role
- iprof: Outputs an
AWS::IAM::InstanceProfile
snippet - elb: Outputs an
AWS::ElasticLoadBalancing::LoadBalancer
snippet
- lconfig: Outputs an