diff options
Diffstat (limited to 'syntax')
-rw-r--r-- | syntax/8th.vim | 2 | ||||
-rw-r--r-- | syntax/csv.vim | 14 | ||||
-rw-r--r-- | syntax/git.vim | 2 | ||||
-rw-r--r-- | syntax/gitcommit.vim | 1 | ||||
-rw-r--r-- | syntax/go.vim | 2 | ||||
-rw-r--r-- | syntax/hcl.vim | 112 | ||||
-rw-r--r-- | syntax/julia.vim | 6 | ||||
-rw-r--r-- | syntax/kotlin.vim | 4 | ||||
-rw-r--r-- | syntax/ruby.vim | 8 | ||||
-rw-r--r-- | syntax/terraform.vim | 66 |
10 files changed, 101 insertions, 116 deletions
diff --git a/syntax/8th.vim b/syntax/8th.vim index f297dc54..abad0092 100644 --- a/syntax/8th.vim +++ b/syntax/8th.vim @@ -297,7 +297,7 @@ syn region eighthComment start="\zs\\" end="$" contains=eighthTodo " Define the default highlighting. if !exists("did_eighth_syntax_inits") let did_eighth_syntax_inits=1 - " The default methods for highlighting. Can be overriden later. + " The default methods for highlighting. Can be overridden later. hi def link eighthTodo Todo hi def link eighthOperators Operator hi def link eighthMath Number diff --git a/syntax/csv.vim b/syntax/csv.vim index ed045c7f..0e1d3a02 100644 --- a/syntax/csv.vim +++ b/syntax/csv.vim @@ -55,6 +55,12 @@ fu! <sid>CheckSaneSearchPattern() "{{{3 let b:csv_cmt = [g:csv_comment] endif + " Make sure, b:csv_cmt always has 2 items + " can happen with e.g. :set cms="#%s + if b:csv_cmt == [] + let b:csv_cmt = ['', ''] + endif + " Second: Check for sane defaults for the column pattern " Not necessary to check for fixed width columns @@ -131,9 +137,11 @@ fu! <sid>DoHighlight() "{{{3 endfor endif " Comment regions - exe 'syn match CSVComment /'. s:cmts. '.*'. - \ (!empty(s:cmte) ? '\%('. s:cmte. '\)\?' - \: ''). '/' + if !empty(s:cmts) + exe 'syn match CSVComment /'. s:cmts. '.*'. + \ (!empty(s:cmte) ? '\%('. s:cmte. '\)\?' + \: ''). '/' + endif hi def link CSVComment Comment endfun diff --git a/syntax/git.vim b/syntax/git.vim index 5688874a..558d39b5 100644 --- a/syntax/git.vim +++ b/syntax/git.vim @@ -33,7 +33,7 @@ syn match gitDiffAdded "{+[^}]*+}" contained containedin=gitDiff syn match gitDiffRemoved "^ \+-.*" contained containedin=gitDiffMerge syn match gitDiffRemoved "\[-[^]]*-\]" contained containedin=gitDiff -syn match gitKeyword /^\%(object\|type\|tag\|commit\|tree\|parent\|encoding\|summary\|boundary\|filename\|previous\)\>/ contained containedin=gitHead nextgroup=gitHash,gitType skipwhite contains=@NoSpell +syn match gitKeyword /^\%(object\|type\|tag\|commit\|tree\|parent\|encoding\|gpgsig\|summary\|boundary\|filename\|previous\)\>/ contained containedin=gitHead nextgroup=gitHash,gitType skipwhite contains=@NoSpell syn match gitKeyword /^\%(tag\>\|ref:\)/ contained containedin=gitHead nextgroup=gitReference skipwhite contains=@NoSpell syn match gitKeyword /^Merge:/ contained containedin=gitHead nextgroup=gitHashAbbrev skipwhite contains=@NoSpell syn match gitMode /^\d\{6\}\>/ contained containedin=gitHead nextgroup=gitType,gitHash skipwhite diff --git a/syntax/gitcommit.vim b/syntax/gitcommit.vim index 8e847650..842c453d 100644 --- a/syntax/gitcommit.vim +++ b/syntax/gitcommit.vim @@ -14,6 +14,7 @@ endif syn case match syn sync minlines=50 +syn sync linebreaks=1 if has("spell") syn spell toplevel diff --git a/syntax/go.vim b/syntax/go.vim index ecb94127..1bca27c2 100644 --- a/syntax/go.vim +++ b/syntax/go.vim @@ -171,7 +171,7 @@ syn match goDecimalError "\<-\=\(_\(\d\+_*\)\+\|\([1-9]\d*_*\)\+__\(\ syn match goHexadecimalInt "\<-\=0[xX]_\?\(\x\+_\?\)\+\>" syn match goHexadecimalError "\<-\=0[xX]_\?\(\x\+_\?\)*\(\([^ \t0-9A-Fa-f_)]\|__\)\S*\|_\)\>" syn match goOctalInt "\<-\=0[oO]\?_\?\(\o\+_\?\)\+\>" -syn match goOctalError "\<-\=0[0-7oO_]*\(\([^ \t0-7oOxX_/)\]\}\:]\|[oO]\{2,\}\|__\)\S*\|_\|[oOxX]\)\>" +syn match goOctalError "\<-\=0[0-7oO_]*\(\([^ \t0-7oOxX_/)\]\}\:;]\|[oO]\{2,\}\|__\)\S*\|_\|[oOxX]\)\>" syn match goBinaryInt "\<-\=0[bB]_\?\([01]\+_\?\)\+\>" syn match goBinaryError "\<-\=0[bB]_\?[01_]*\([^ \t01_)]\S*\|__\S*\|_\)\>" diff --git a/syntax/hcl.vim b/syntax/hcl.vim index d11c031b..7b6ab441 100644 --- a/syntax/hcl.vim +++ b/syntax/hcl.vim @@ -1,48 +1,76 @@ -if polyglot#init#is_disabled(expand('<sfile>:p'), 'hcl', 'syntax/hcl.vim') +if polyglot#init#is_disabled(expand('<sfile>:p'), 'terraform', 'syntax/hcl.vim') finish endif - -if exists("b:current_syntax") +" Forked from Larry Gilbert's syntax file +" github.com/L2G/vim-syntax-terraform +if exists('b:current_syntax') finish endif -syn match hclEqual '=' -syn match hclSimpleString '"[^\"]*"' -syn region hclComment display oneline start='\%\(^\|\s\)#' end='$' -syn region hclComment display oneline start='\%\(^\|\s\)//' end='$' -syn region hclInterpolation display oneline start='(' end=')' contains=hclInterpolation,hclSimpleString -syn region hclSmartString display oneline start='"' end='"\s*$' contains=hclInterpolation - -syn keyword hclRootKeywords variable provider resource nextgroup=hclString,hclString skipwhite -syn keyword hclRootKeywords default nextgroup=hclEquals skipwhite - - -syn keyword hclAwsResourcesKeywords availability_zones desired_capacity force_delete health_check_grace_period health_check_type launch_configuration load_balancers max_size min_size name vpc_zone_identifier nextgroup=hclEquals,hclString skipwhite -syn keyword hclAwsResourcesKeywords allocated_storage availability_zone backup_retention_period backup_window db_subnet_group_name engine engine_version final_snapshot_identifier identifier instance_class iops maintenance_window multi_az name password port publicly_accessible security_group_names skip_final_snapshot username vpc_security_group_ids nextgroup=hclEquals,hclString skipwhite -syn keyword hclAwsResourcesKeywords cidr description ingress name security_group_id security_group_name security_group_owner_id source_security_group_id nextgroup=hclEquals,hclString skipwhite -syn keyword hclAwsResourcesKeywords description name subnet_ids nextgroup=hclEquals,hclString skipwhite -syn keyword hclAwsResourcesKeywords instance vpc nextgroup=hclEquals,hclString skipwhite -syn keyword hclAwsResourcesKeywords availability_zones health_check healthy_threshold instance_port instance_protocol instances internal interval lb_port lb_protocol listener name security_groups ssl_certificate_id subnets target timeout unhealthy_threshold nextgroup=hclEquals,hclString skipwhite -syn keyword hclAwsResourcesKeywords ami associate_public_ip_address availability_zone ebs_optimized iam_instance_profile instance_type key_name private_ip security_groups source_dest_check subnet_id tags user_data nextgroup=hclEquals,hclString skipwhite -syn keyword hclAwsResourcesKeywords vpc_id nextgroup=hclEquals,hclString skipwhite -syn keyword hclAwsResourcesKeywords iam_instance_profile image_id instance_type key_name name name_prefix security_groups user_data nextgroup=hclEquals,hclString skipwhite -syn keyword hclAwsResourcesKeywords name records ttl type zone_id nextgroup=hclEquals,hclString skipwhite -syn keyword hclAwsResourcesKeywords name nextgroup=hclEquals,hclString skipwhite -syn keyword hclAwsResourcesKeywords route_table_id subnet_id nextgroup=hclEquals,hclString skipwhite -syn keyword hclAwsResourcesKeywords cidr_block gateway_id instance_id route vpc_id nextgroup=hclEquals,hclString skipwhite -syn keyword hclAwsResourcesKeywords acl bucket nextgroup=hclEquals,hclString skipwhite -syn keyword hclAwsResourcesKeywords cidr_blocks description from_port ingress name owner_id protocol security_groups self tags to_port vpc_id nextgroup=hclEquals,hclString skipwhite -syn keyword hclAwsResourcesKeywords availability_zone- cidr_block map_public_ip_on_launch vpc_id nextgroup=hclEquals,hclString skipwhite -syn keyword hclAwsResourcesKeywords cidr_block enable_dns_hostnames enable_dns_support tags nextgroup=hclEquals,hclString skipwhite - - -hi def link hclComment Comment -hi def link hclEqual Operator -hi def link hclRootKeywords Statement -hi def link hclAwsResourcesKeywords Type -hi def link hclSmartString String -hi def link hclInterpolation String -hi def link hclSimpleString PreProc - -let b:current_syntax = "hcl" +let s:cpo_save = &cpoptions +set cpoptions&vim + +" Identifiers are made up of alphanumeric characters, underscores, and +" hyphens. +if has('patch-7.4.1142') + syn iskeyword a-z,A-Z,48-57,_,- +endif + +syn case match + +" A block is introduced by a type, some number of labels - which are either +" strings or identifiers - and an opening curly brace. Match the type. +syn match hclBlockType /^\s*\zs\K\k*\ze\s\+\(\("\K\k*"\|\K\k*\)\s\+\)*{/ + +" An attribute name is an identifier followed by an equals sign. +syn match hclAttributeAssignment /\(\K\k*\.\)*\K\k*\s\+=\s/ contains=hclAttributeName +syn match hclAttributeName /\<\K\k*\>/ contained + +syn keyword hclValueBool true false + +syn keyword hclTodo contained TODO FIXME XXX BUG +syn region hclComment start="/\*" end="\*/" contains=hclTodo,@Spell +syn region hclComment start="#" end="$" contains=hclTodo,@Spell +syn region hclComment start="//" end="$" contains=hclTodo,@Spell + +""" misc. +syn match hclValueDec "\<[0-9]\+\([kKmMgG]b\?\)\?\>" +syn match hclValueHexaDec "\<0x[0-9a-f]\+\([kKmMgG]b\?\)\?\>" +syn match hclBraces "[\[\]]" + +""" skip \" and \\ in strings. +syn region hclValueString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=hclStringInterp +syn region hclStringInterp matchgroup=hclBraces start=/\(^\|[^$]\)\$\zs{/ end=/}/ contained contains=ALLBUT,hclAttributeName +syn region hclHereDocText start=/<<-\?\z([a-z0-9A-Z]\+\)/ end=/^\s*\z1/ contains=hclStringInterp + +"" Functions. +syn match hclFunction "[a-z0-9]\+(\@=" + +""" HCL2 +syn keyword hclRepeat for in +syn keyword hclConditional if +syn keyword hclValueNull null + +" enable block folding +syn region hclBlockBody matchgroup=hclBraces start="{" end="}" fold transparent + +hi def link hclComment Comment +hi def link hclTodo Todo +hi def link hclBraces Delimiter +hi def link hclAttributeName Identifier +hi def link hclBlockType Type +hi def link hclValueBool Boolean +hi def link hclValueDec Number +hi def link hclValueHexaDec Number +hi def link hclValueString String +hi def link hclHereDocText String +hi def link hclFunction Function +hi def link hclRepeat Repeat +hi def link hclConditional Conditional +hi def link hclValueNull Constant + +let b:current_syntax = 'hcl' + +let &cpoptions = s:cpo_save +unlet s:cpo_save diff --git a/syntax/julia.vim b/syntax/julia.vim index 53dea077..88aa464e 100644 --- a/syntax/julia.vim +++ b/syntax/julia.vim @@ -327,15 +327,15 @@ exec 'syntax match juliaStringVarsPla contained "\$' . s:idregex . '"' " TODO improve RegEx syntax region juliaRegEx matchgroup=juliaStringDelim start=+\<r\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1[imsx]*+ -syntax cluster juliaSpecialChars contains=juliaSpecialChar,juliaOctalEscapeChar,juliaHexEscapeChar,juliaUniCharSmall,juliaUniCharLarge +syntax cluster juliaSpecialChars contains=juliaSpecialChar,juliaDoubleBackslash,juliaEscapedQuote,juliaOctalEscapeChar,juliaHexEscapeChar,juliaUniCharSmall,juliaUniCharLarge syntax match juliaSpecialChar display contained "\\." syntax match juliaOctalEscapeChar display contained "\\\o\{3\}" syntax match juliaHexEscapeChar display contained "\\x\x\{2\}" syntax match juliaUniCharSmall display contained "\\u\x\{1,4\}" syntax match juliaUniCharLarge display contained "\\U\x\{1,8\}" syntax cluster juliaSpecialCharsRaw contains=juliaDoubleBackslash,juliaEscapedQuote -syntax match juliaDoubleBackslash display contained "\\\\" -syntax match juliaEscapedQuote display contained "\\\"" +syntax match juliaDoubleBackslash contained "\\\\" +syntax match juliaEscapedQuote contained "\\\"" syntax cluster juliaPrintfChars contains=juliaErrorPrintfFmt,juliaPrintfFmt syntax match juliaErrorPrintfFmt display contained "\\\?%." diff --git a/syntax/kotlin.vim b/syntax/kotlin.vim index ca7fbef5..b5e75dba 100644 --- a/syntax/kotlin.vim +++ b/syntax/kotlin.vim @@ -5,7 +5,7 @@ endif " Vim syntax file " Language: Kotlin " Maintainer: Alexander Udalov -" Latest Revision: 20 April 2021 +" Latest Revision: 3 July 2021 if exists('b:current_syntax') finish @@ -101,6 +101,8 @@ syn match ktEscapedName "\v`.*`" syn match ktExclExcl "!!" syn match ktArrow "->" +exec "syntax sync ccomment ktComment minlines=10" + hi def link ktStatement Statement hi def link ktConditional Conditional hi def link ktRepeat Repeat diff --git a/syntax/ruby.vim b/syntax/ruby.vim index ce28d380..bbf86e8a 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -69,7 +69,7 @@ endfunction com! -nargs=* SynFold call s:run_syntax_fold(<q-args>) " Not-Top Cluster {{{1 -syn cluster rubyNotTop contains=@rubyCommentNotTop,@rubyStringNotTop,@rubyRegexpSpecial,@rubyDeclaration,@rubyExceptionHandler,@rubyClassOperator,rubyConditional,rubyModuleName,rubyClassName,rubySymbolDelimiter,rubyParentheses,@Spell +syn cluster rubyNotTop contains=@rubyCommentNotTop,@rubyStringNotTop,@rubyRegexpSpecial,@rubyDeclaration,@rubyExceptionHandler,@rubyClassOperator,rubyConditional,rubyModuleName,rubyClassName,rubySymbolDelimiter,rubyDoubleQuoteSymbolDelimiter,rubySingleQuoteSymbolDelimiter,rubyParentheses,@Spell " Whitespace Errors {{{1 if exists("ruby_space_errors") @@ -468,6 +468,10 @@ syn match rubyDefinedOperator "\%#=1\<defined?" display syn match rubySymbol "\%(\w\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[?!]\=::\@!"he=e-1 contained containedin=rubyBlockParameterList,rubyCurlyBlock syn match rubySymbol "[]})\"':]\@1<!\<\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="he=e-1 syn match rubySymbol "[[:space:],{(]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="hs=s+1,he=e-1 +syn match rubySingleQuoteSymbolDelimiter "'" contained +syn match rubySymbol "'\%(\\.\|[^']\)*'::\@!"he=e-1 contains=rubyQuoteEscape,rubyBackslashEscape,rubySingleQuoteSymbolDelimiter +syn match rubyDoubleQuoteSymbolDelimiter "\"" contained +syn match rubySymbol "\"\%(\\.\|[^\"]\)*\"::\@!"he=e-1 contains=@rubyStringSpecial,rubyDoubleQuoteSymbolDelimiter " __END__ Directive {{{1 SynFold '__END__' syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$" @@ -568,6 +572,8 @@ hi def link rubyHeredocDelimiter rubyStringDelimiter hi def link rubyPercentRegexpDelimiter rubyRegexpDelimiter hi def link rubyPercentStringDelimiter rubyStringDelimiter hi def link rubyPercentSymbolDelimiter rubySymbolDelimiter +hi def link rubyDoubleQuoteSymbolDelimiter rubySymbolDelimiter +hi def link rubySingleQuoteSymbolDelimiter rubySymbolDelimiter hi def link rubyRegexpDelimiter rubyStringDelimiter hi def link rubySymbolDelimiter rubySymbol hi def link rubyString String diff --git a/syntax/terraform.vim b/syntax/terraform.vim index c99dbe47..7a330e45 100644 --- a/syntax/terraform.vim +++ b/syntax/terraform.vim @@ -2,74 +2,14 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'terraform', 'syntax/terraform finish endif -" Forked from Larry Gilbert's syntax file -" github.com/L2G/vim-syntax-terraform - if exists('b:current_syntax') finish endif +runtime! syntax/hcl.vim +unlet b:current_syntax -let s:cpo_save = &cpoptions -set cpoptions&vim - -" Identifiers are made up of alphanumeric characters, underscores, and -" hyphens. -if has('patch-7.4.1142') - syn iskeyword a-z,A-Z,48-57,_,- -endif - -syn case match - -" A block is introduced by a type, some number of labels - which are either -" strings or identifiers - and an opening curly brace. Match the type. -syn match terraBlockIntroduction /^\s*\zs\K\k*\ze\s\+\(\("\K\k*"\|\K\k*\)\s\+\)*{/ contains=terraBlockType -syn keyword terraBlockType contained data locals module output provider resource terraform variable - -syn keyword terraValueBool true false on off yes no - -syn keyword terraTodo contained TODO FIXME XXX BUG TF-UPGRADE-TODO -syn region terraComment start="/\*" end="\*/" contains=terraTodo,@Spell -syn region terraComment start="#" end="$" contains=terraTodo,@Spell -syn region terraComment start="//" end="$" contains=terraTodo,@Spell - -""" misc. -syn match terraValueDec "\<[0-9]\+\([kKmMgG]b\?\)\?\>" -syn match terraValueHexaDec "\<0x[0-9a-f]\+\([kKmMgG]b\?\)\?\>" -syn match terraBraces "[\[\]]" - -""" skip \" and \\ in strings. -syn region terraValueString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=terraStringInterp -syn region terraStringInterp matchgroup=terraBraces start=/\(^\|[^$]\)\$\zs{/ end=/}/ contained contains=ALL -syn region terraHereDocText start=/<<-\?\z([a-z0-9A-Z]\+\)/ end=/^\s*\z1/ contains=terraStringInterp - -"" Functions. -syn match terraFunction "[a-z0-9]\+(\@=" - -""" HCL2 -syn keyword terraRepeat for in -syn keyword terraConditional if syn keyword terraType string bool number object tuple list map set any -syn keyword terraValueNull null - -" enable block folding -syn region terraBlockBody matchgroup=terraBraces start="{" end="}" fold transparent -hi def link terraComment Comment -hi def link terraTodo Todo -hi def link terraBraces Delimiter -hi def link terraBlockType Structure -hi def link terraValueBool Boolean -hi def link terraValueDec Number -hi def link terraValueHexaDec Number -hi def link terraValueString String -hi def link terraHereDocText String -hi def link terraFunction Function -hi def link terraRepeat Repeat -hi def link terraConditional Conditional -hi def link terraType Type -hi def link terraValueNull Constant +hi def link terraType Type let b:current_syntax = 'terraform' - -let &cpoptions = s:cpo_save -unlet s:cpo_save |