robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
aa9fd08034
master
1" Vim syntax file 2" Language: HCL 3" Maintainer: Gregory Anders 4" Upstream: https://github.com/hashivim/vim-terraform 5" Last Change: 2024-09-03 6" License: ISC 7" 8" Copyright (c) 2014-2016 Mark Cornick <mark@markcornick.com> 9" 10" Permission to use, copy, modify, and/or distribute this software for any purpose 11" with or without fee is hereby granted, provided that the above copyright notice 12" and this permission notice appear in all copies. 13" 14" THE SOFTWARE IS PROVIDED 'AS IS' AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 15" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 16" FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 17" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 18" OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 19" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 20" THIS SOFTWARE. 21 22if exists ( 'b:current_syntax' ) 23finish 24endif 25 26syn iskeyword a-z,A-Z,48-57,_,- 27 28syn case match 29 30" A block is introduced by a type, some number of labels - which are either 31" strings or identifiers - and an opening curly brace. Match the type. 32syn match hclBlockType /^\s * \zs\K\k * \ze\s\+\(\("\K\k * "\|\K\k * \)\s\+\) * { / 33 34" An attribute name is an identifier followed by an equals sign. 35syn match hclAttributeAssignment /\(\K\k * \.\) * \K\k * \s\+=\s /contains = hclAttributeName 36syn match hclAttributeName /\<\K\k * \> /contained 37 38syn keyword hclValueBool true false 39 40syn keyword hclTodo contained TODO FIXME XXX BUG 41syn region hclComment start = "/\* "end = "\*/ "contains = hclTodo , @Spell 42syn region hclComment start = "# "end = "$ "contains = hclTodo , @Spell 43syn region hclComment start = "// "end = "$ "contains = hclTodo , @Spell 44 45""" misc. 46syn match hclValueDec "\< [ 0-9 ] \+\( [ kKmMgG ] b\?\)\?\> " 47syn match hclValueHexaDec "\<0x [ 0-9a-f ] \+\( [ kKmMgG ] b\?\)\?\> " 48syn match hclBraces "[ \[\] ] " 49 50""" skip \" and \\ in strings. 51syn region hclValueString start = /" /skip = /\\\\\|\\" /end = /" /contains = hclStringInterp 52syn region hclStringInterp matchgroup = hclBraces start = /\(^\| [ ^$ ] \)\$\zs{ /end = /} /contained contains = ALLBUT , hclAttributeName 53syn region hclHereDocText start = /<<-\?\z( [ a-z0-9A-Z ] \+\) /end = /^\s * \z1 /contains = hclStringInterp 54 55"" Functions. 56syn match hclFunction "[ a-z0-9 ] \+(\@= " 57 58""" HCL2 59syn keyword hclRepeat for in 60syn keyword hclConditional if 61syn keyword hclValueNull null 62 63" enable block folding 64syn region hclBlockBody matchgroup = hclBraces start = "{ "end = "} "fold transparent 65 66hi def link hclComment Comment 67hi def link hclTodo Todo 68hi def link hclBraces Delimiter 69hi def link hclAttributeName Identifier 70hi def link hclBlockType Type 71hi def link hclValueBool Boolean 72hi def link hclValueDec Number 73hi def link hclValueHexaDec Number 74hi def link hclValueString String 75hi def link hclHereDocText String 76hi def link hclFunction Function 77hi def link hclRepeat Repeat 78hi def link hclConditional Conditional 79hi def link hclValueNull Constant 80 81let b: current_syntax = 'hcl'