summaryrefslogtreecommitdiffstats
path: root/syntax
diff options
context:
space:
mode:
Diffstat (limited to 'syntax')
-rw-r--r--syntax/ansible.vim2
-rw-r--r--syntax/crystal.vim3
-rw-r--r--syntax/elm.vim2
-rw-r--r--syntax/eruby.vim16
-rw-r--r--syntax/go.vim4
-rw-r--r--syntax/graphql.vim4
-rw-r--r--syntax/i3.vim2
-rw-r--r--syntax/javascript.vim17
-rw-r--r--syntax/jinja2.vim2
-rw-r--r--syntax/julia.vim2
-rw-r--r--syntax/nginx.vim1
-rw-r--r--syntax/rust.vim59
-rw-r--r--syntax/toml.vim12
-rw-r--r--syntax/vifm.vim15
14 files changed, 105 insertions, 36 deletions
diff --git a/syntax/ansible.vim b/syntax/ansible.vim
index 0b732101..2f2d3b83 100644
--- a/syntax/ansible.vim
+++ b/syntax/ansible.vim
@@ -26,7 +26,7 @@ endif
syn cluster jinjaSLSBlocks add=jinjaTagBlock,jinjaVarBlock,jinjaComment
" https://github.com/mitsuhiko/jinja2/blob/6b7c0c23/ext/Vim/jinja.vim
syn region jinjaTagBlock matchgroup=jinjaTagDelim start=/{%-\?/ end=/-\?%}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment,@jinjaSLSBlocks
-syn region jinjaVarBlock matchgroup=jinjaVarDelim start=/{{-\?/ end=/-\?}}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment,@jinjaSLSBlocks
+syn region jinjaVarBlock matchgroup=jinjaVarDelim start=/{{-\?/ end=/-\?}}/ containedin=ALLBUT,yamlComment,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment,@jinjaSLSBlocks
syn region jinjaComment matchgroup=jinjaCommentDelim start="{#" end="#}" containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaString,@jinjaSLSBlocks
highlight link jinjaVariable Constant
highlight link jinjaVarDelim Delimiter
diff --git a/syntax/crystal.vim b/syntax/crystal.vim
index 32629781..88395596 100644
--- a/syntax/crystal.vim
+++ b/syntax/crystal.vim
@@ -274,7 +274,8 @@ syn match crystalLinkAttr "]" contained containedin=crystalLinkAttrRegion displa
if !exists('g:crystal_no_special_methods')
syn keyword crystalAccess protected private
" attr is a common variable name
- syn keyword crystalAttribute getter setter property abstract
+ syn keyword crystalAttribute abstract
+ syn match crystalAttribute "\<\%(class_\)\=\%(getter\|setter\|property\)[!?]\=\s" display
syn match crystalControl "\<\%(abort\|at_exit\|exit\|fork\|loop\)\>[?!]\@!" display
syn keyword crystalException raise
" false positive with 'include?'
diff --git a/syntax/elm.vim b/syntax/elm.vim
index a26fb0f6..67d737a8 100644
--- a/syntax/elm.vim
+++ b/syntax/elm.vim
@@ -43,7 +43,7 @@ syn match elmInt "-\?\<\d\+\>\|0[xX][0-9a-fA-F]\+\>"
syn match elmFloat "\(\<\d\+\.\d\+\>\)"
" Identifiers
-syn match elmTopLevelDecl "^\s*[a-zA-Z][a-zA-z0-9_]*\('\)*\s\+:\s\+" contains=elmOperator
+syn match elmTopLevelDecl "^\s*[a-zA-Z][a-zA-z0-9_]*\('\)*\s\+:\(\r\n\|\r\|\n\|\s\)\+" contains=elmOperator
" Folding
syn region elmTopLevelTypedef start="type" end="\n\(\n\n\)\@=" contains=ALL fold
diff --git a/syntax/eruby.vim b/syntax/eruby.vim
index 75354042..1e760988 100644
--- a/syntax/eruby.vim
+++ b/syntax/eruby.vim
@@ -6,7 +6,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1
" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
-if exists("b:current_syntax")
+if &syntax !~# '\<eruby\>' || get(b:, 'current_syntax') =~# '\<eruby\>'
finish
endif
@@ -20,6 +20,8 @@ endif
if &filetype =~ '^eruby\.'
let b:eruby_subtype = matchstr(&filetype,'^eruby\.\zs\w\+')
+elseif &filetype =~ '^.*\.eruby\>'
+ let b:eruby_subtype = matchstr(&filetype,'^.\{-\}\ze\.eruby\>')
elseif !exists("b:eruby_subtype") && main_syntax == 'eruby'
let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+')
@@ -43,16 +45,20 @@ elseif !exists("b:eruby_subtype") && main_syntax == 'eruby'
endif
if !exists("b:eruby_nest_level")
- let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.\%(erb\|rhtml\)\>','@','g'),'[^@]','','g'))
+ if &syntax =~# '\<eruby\.eruby\>'
+ let b:eruby_nest_level = strlen(substitute(substitute(&filetype,'\C\<eruby\>','@','g'),'[^@]','','g'))
+ else
+ let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.\%(erb\|rhtml\)\>','@','g'),'[^@]','','g'))
+ endif
endif
if !b:eruby_nest_level
let b:eruby_nest_level = 1
endif
-if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=? 'eruby'
+if get(b:, 'eruby_subtype', '') !~# '^\%(eruby\)\=$' && &syntax =~# '^eruby\>'
exe "runtime! syntax/".b:eruby_subtype.".vim"
- unlet! b:current_syntax
endif
+unlet! b:current_syntax
syn include @rubyTop syntax/ruby.vim
syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment
@@ -67,7 +73,7 @@ exe 'syn region erubyComment matchgroup=erubyDelimiter start="<%\{1,'.b:erub
hi def link erubyDelimiter PreProc
hi def link erubyComment Comment
-let b:current_syntax = 'eruby'
+let b:current_syntax = matchstr(&syntax, '^.*\<eruby\>')
if main_syntax == 'eruby'
unlet main_syntax
diff --git a/syntax/go.vim b/syntax/go.vim
index ab5ac8af..c3c26ed6 100644
--- a/syntax/go.vim
+++ b/syntax/go.vim
@@ -373,6 +373,10 @@ function! s:hi()
" :GoCoverage commands
hi def goCoverageCovered ctermfg=green guifg=#A6E22E
hi def goCoverageUncover ctermfg=red guifg=#F92672
+
+ " :GoDebug commands
+ hi GoDebugBreakpoint term=standout ctermbg=117 ctermfg=0 guibg=#BAD4F5 guifg=Black
+ hi GoDebugCurrent term=reverse ctermbg=12 ctermfg=7 guibg=DarkBlue guifg=White
endfunction
augroup vim-go-hi
diff --git a/syntax/graphql.vim b/syntax/graphql.vim
index c498afa4..b59151af 100644
--- a/syntax/graphql.vim
+++ b/syntax/graphql.vim
@@ -39,8 +39,8 @@ syn match graphqlConstant "\<[A-Z_]\+\>" display
syn keyword graphqlMetaFields __schema __type __typename
-syn region graphqlFold matchgroup=graphqlBraces start="{" end=/}\(\_s\+\ze\("\|{\)\)\@!/ transparent fold contains=ALLBUT,graphqlStructure
-syn region graphqlList matchgroup=graphqlBraces start="\[" end=/]\(\_s\+\ze"\)\@!/ transparent contains=ALLBUT,graphqlDirective,graphqlStructure
+syn region graphqlFold matchgroup=graphqlBraces start="{" end="}" transparent fold contains=ALLBUT,graphqlStructure
+syn region graphqlList matchgroup=graphqlBraces start="\[" end="]" transparent contains=ALLBUT,graphqlDirective,graphqlStructure
hi def link graphqlComment Comment
hi def link graphqlOperator Operator
diff --git a/syntax/i3.vim b/syntax/i3.vim
index cbac6a53..45bf846e 100644
--- a/syntax/i3.vim
+++ b/syntax/i3.vim
@@ -58,7 +58,7 @@ syn keyword i3SeparatorSymbol separator_symbol nextgroup=@i3String skipwhite
" Set statement
syn match i3SetVar "\$\w\+" contained nextgroup=@i3String skipwhite
-syn keyword i3SetKeyword set nextgroup=i3SetVar skipwhite
+syn keyword i3SetKeyword set set_from_resource nextgroup=i3SetVar skipwhite
" Workspaces
syn keyword i3WsKeyword workspace nextgroup=i3WsSpecialParam,@i3String skipwhite
diff --git a/syntax/javascript.vim b/syntax/javascript.vim
index a4ffaa39..d1480e7c 100644
--- a/syntax/javascript.vim
+++ b/syntax/javascript.vim
@@ -15,7 +15,7 @@ if !exists("main_syntax")
endif
" Dollar sign is permitted anywhere in an identifier
-if v:version > 704 || v:version == 704 && has('patch1142')
+if (v:version > 704 || v:version == 704 && has('patch1142')) && main_syntax == 'javascript'
syntax iskeyword @,48-57,_,192-255,$
else
setlocal iskeyword+=$
@@ -27,7 +27,7 @@ syntax sync fromstart
syntax case match
syntax match jsNoise /[:,;]/
-syntax match jsNoise /\./ skipwhite skipempty nextgroup=jsObjectProp,jsFuncCall,jsPrototype,jsTaggedTemplate
+syntax match jsDot /\./ skipwhite skipempty nextgroup=jsObjectProp,jsFuncCall,jsPrototype,jsTaggedTemplate
syntax match jsObjectProp contained /\<\K\k*/
syntax match jsFuncCall /\<\K\k*\ze\s*(/
syntax match jsParensError /[)}\]]/
@@ -74,12 +74,12 @@ syntax region jsRegexpString start=+\%(\%(\<return\|\<typeof\|\_[^)\]'"[:blan
syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod
" Objects
+syntax match jsObjectShorthandProp contained /\<\k*\ze\s*/ skipwhite skipempty nextgroup=jsObjectSeparator
syntax match jsObjectKey contained /\<\k*\ze\s*:/ contains=jsFunctionKey skipwhite skipempty nextgroup=jsObjectValue
-syntax match jsObjectColon contained /:/ skipwhite skipempty
syntax region jsObjectKeyString contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue
syntax region jsObjectKeyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsObjectValue,jsFuncArgs extend
syntax match jsObjectSeparator contained /,/
-syntax region jsObjectValue contained matchgroup=jsNoise start=/:/ end=/[,}]\@=/ contains=@jsExpression extend
+syntax region jsObjectValue contained matchgroup=jsObjectColon start=/:/ end=/[,}]\@=/ contains=@jsExpression extend
syntax match jsObjectFuncName contained /\<\K\k*\ze\_s*(/ skipwhite skipempty nextgroup=jsFuncArgs
syntax match jsFunctionKey contained /\<\K\k*\ze\s*:\s*function\>/
syntax match jsObjectMethodType contained /\<[gs]et\ze\s\+\K\k*/ skipwhite skipempty nextgroup=jsObjectFuncName
@@ -151,8 +151,8 @@ syntax region jsFinallyBlock contained matchgroup=jsFinallyBraces s
syntax region jsSwitchBlock contained matchgroup=jsSwitchBraces start=/{/ end=/}/ contains=@jsAll,jsBlock,jsSwitchCase extend fold
syntax region jsRepeatBlock contained matchgroup=jsRepeatBraces start=/{/ end=/}/ contains=@jsAll,jsBlock extend fold
syntax region jsDestructuringBlock contained matchgroup=jsDestructuringBraces start=/{/ end=/}/ contains=jsDestructuringProperty,jsDestructuringAssignment,jsDestructuringNoise,jsDestructuringPropertyComputed,jsSpreadExpression,jsComment extend fold
-syntax region jsDestructuringArray contained matchgroup=jsDestructuringBraces start=/\[/ end=/\]/ contains=jsDestructuringPropertyValue,jsNoise,jsDestructuringProperty,jsSpreadExpression,jsDestructuringBlock,jsComment extend fold
-syntax region jsObject contained matchgroup=jsObjectBraces start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsDecorator,jsAsyncKeyword extend fold
+syntax region jsDestructuringArray contained matchgroup=jsDestructuringBraces start=/\[/ end=/\]/ contains=jsDestructuringPropertyValue,jsNoise,jsDestructuringProperty,jsSpreadExpression,jsDestructuringBlock,jsDestructuringArray,jsComment extend fold
+syntax region jsObject contained matchgroup=jsObjectBraces start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectShorthandProp,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsDecorator,jsAsyncKeyword extend fold
syntax region jsBlock matchgroup=jsBraces start=/{/ end=/}/ contains=@jsAll,jsSpreadExpression extend fold
syntax region jsModuleGroup contained matchgroup=jsModuleBraces start=/{/ end=/}/ contains=jsModuleKeyword,jsModuleComma,jsModuleAs,jsComment,jsFlowTypeKeyword skipwhite skipempty nextgroup=jsFrom fold
syntax region jsSpreadExpression contained matchgroup=jsSpreadOperator start=/\.\.\./ end=/[,}\]]\@=/ contains=@jsExpression
@@ -232,7 +232,7 @@ if exists("javascript_plugin_flow")
runtime extras/flow.vim
endif
-syntax cluster jsExpression contains=jsBracket,jsParen,jsObject,jsTernaryIf,jsTaggedTemplate,jsTemplateString,jsString,jsRegexpString,jsNumber,jsFloat,jsOperator,jsOperatorKeyword,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsFutureKeys,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsFuncCall,jsUndefined,jsNan,jsPrototype,jsBuiltins,jsNoise,jsClassDefinition,jsArrowFunction,jsArrowFuncArgs,jsParensError,jsComment,jsArguments,jsThis,jsSuper,jsDo,jsForAwait,jsAsyncKeyword,jsStatement
+syntax cluster jsExpression contains=jsBracket,jsParen,jsObject,jsTernaryIf,jsTaggedTemplate,jsTemplateString,jsString,jsRegexpString,jsNumber,jsFloat,jsOperator,jsOperatorKeyword,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsFutureKeys,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsFuncCall,jsUndefined,jsNan,jsPrototype,jsBuiltins,jsNoise,jsClassDefinition,jsArrowFunction,jsArrowFuncArgs,jsParensError,jsComment,jsArguments,jsThis,jsSuper,jsDo,jsForAwait,jsAsyncKeyword,jsStatement,jsDot
syntax cluster jsAll contains=@jsExpression,jsStorageClass,jsConditional,jsRepeat,jsReturn,jsException,jsTry,jsNoise,jsBlockLabel
" Define the default highlighting.
@@ -287,6 +287,7 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsGenerator jsFunction
HiLink jsArrowFuncArgs jsFuncArgs
HiLink jsFuncName Function
+ HiLink jsFuncCall Function
HiLink jsClassFuncName jsFuncName
HiLink jsObjectFuncName Function
HiLink jsArguments Special
@@ -309,6 +310,7 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsBooleanFalse Boolean
HiLink jsObjectColon jsNoise
HiLink jsNoise Noise
+ HiLink jsDot Noise
HiLink jsBrackets Noise
HiLink jsParens Noise
HiLink jsBraces Noise
@@ -343,6 +345,7 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsParensDecorator jsParens
HiLink jsFuncArgOperator jsFuncArgs
HiLink jsClassProperty jsObjectKey
+ HiLink jsObjectShorthandProp jsObjectKey
HiLink jsSpreadOperator Operator
HiLink jsRestOperator Operator
HiLink jsRestExpression jsFuncArgs
diff --git a/syntax/jinja2.vim b/syntax/jinja2.vim
index 55d9fbfd..402bad56 100644
--- a/syntax/jinja2.vim
+++ b/syntax/jinja2.vim
@@ -50,7 +50,7 @@ syn region jinjaNested matchgroup=jinjaOperator start="\[" end="\]" transparent
syn region jinjaNested matchgroup=jinjaOperator start="{" end="}" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained
syn region jinjaTagBlock matchgroup=jinjaTagDelim start=/{%-\?/ end=/-\?%}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment
-syn region jinjaVarBlock matchgroup=jinjaVarDelim start=/{{-\?/ end=/-\?}}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment
+syn region jinjaVarBlock matchgroup=jinjaVarDelim start=/{{-\?/ end=/-\?}}/ containedin=ALLBUT,yamlComment,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment
" Jinja template 'raw' tag
syn region jinjaRaw matchgroup=jinjaRawDelim start="{%\s*raw\s*%}" end="{%\s*endraw\s*%}" containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaString,jinjaComment
diff --git a/syntax/julia.vim b/syntax/julia.vim
index 3e5c1433..8d7d7b4d 100644
--- a/syntax/julia.vim
+++ b/syntax/julia.vim
@@ -84,7 +84,7 @@ let s:binop_chars_extra = "\\U214B\\U2190-\\U2194\\U219A\\U219B\\U21A0\\U21A3\\U
let s:idregex = '\%([^' . s:nonidS_chars . '0-9!?' . s:uniop_chars . s:binop_chars . '][^' . s:nonidS_chars . s:uniop_chars . s:binop_chars . s:binop_chars_extra . ']*\|\<?\>\)'
let s:operators = '\%(' . '\.\%([-+*/^÷%|&!]\|//\|\\\|<<\|>>>\?\)\?=' .
- \ '\|' . '[:$<>]=\|||\|&&\||>\|<|\|<:\|:>\|::\|<<\|>>>\?\|//\|[-=]>\|\.\{3\}' .
+ \ '\|' . '[:$<>]=\|||\|&&\||>\|<|\|<:\|>:\|::\|<<\|>>>\?\|//\|[-=]>\|\.\{3\}' .
\ '\|' . '[' . s:uniop_chars . '!$]' .
\ '\|' . '\.\?[' . s:binop_chars . s:binop_chars_extra . ']' .
\ '\)'
diff --git a/syntax/nginx.vim b/syntax/nginx.vim
index 944b36ab..10d69b26 100644
--- a/syntax/nginx.vim
+++ b/syntax/nginx.vim
@@ -558,6 +558,7 @@ syn keyword ngxDirective ssl_protocols nextgroup=ngxSSLProtocol,ngxSSLProtocolDe
syn match ngxSSLProtocol 'TLSv1' contained nextgroup=ngxSSLProtocol,ngxSSLProtocolDeprecated skipwhite
syn match ngxSSLProtocol 'TLSv1\.1' contained nextgroup=ngxSSLProtocol,ngxSSLProtocolDeprecated skipwhite
syn match ngxSSLProtocol 'TLSv1\.2' contained nextgroup=ngxSSLProtocol,ngxSSLProtocolDeprecated skipwhite
+syn match ngxSSLProtocol 'TLSv1\.3' contained nextgroup=ngxSSLProtocol,ngxSSLProtocolDeprecated skipwhite
" Do not enable highlighting of insecure protocols if sslecure is loaded
if !exists('g:loaded_sslsecure')
diff --git a/syntax/rust.vim b/syntax/rust.vim
index 81abf942..90e5b6b6 100644
--- a/syntax/rust.vim
+++ b/syntax/rust.vim
@@ -9,9 +9,9 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
if version < 600
- syntax clear
+ syntax clear
elseif exists("b:current_syntax")
- finish
+ finish
endif
" Syntax definitions {{{1
@@ -29,6 +29,7 @@ syn match rustPanic "\<panic\(\w\)*!" contained
syn keyword rustKeyword break
syn keyword rustKeyword box nextgroup=rustBoxPlacement skipwhite skipempty
syn keyword rustKeyword continue
+syn keyword rustKeyword crate
syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite skipempty
syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite skipempty
syn keyword rustKeyword in impl let
@@ -45,8 +46,6 @@ syn keyword rustKeyword mod trait nextgroup=rustIdentifier skipwhite skipe
syn keyword rustStorage move mut ref static const
syn match rustDefault /\<default\ze\_s\+\(impl\|fn\|type\|const\)\>/
-syn keyword rustInvalidBareKeyword crate
-
syn keyword rustPubScopeCrate crate contained
syn match rustPubScopeDelim /[()]/ contained
syn match rustPubScope /([^()]*)/ contained contains=rustPubScopeDelim,rustPubScopeCrate,rustSuper,rustModPath,rustModPathSep,rustSelf transparent
@@ -155,6 +154,16 @@ syn region rustDerive start="derive(" end=")" contained contains=rustDer
" Some are deprecated (Encodable, Decodable) or to be removed after a new snapshot (Show).
syn keyword rustDeriveTrait contained Clone Hash RustcEncodable RustcDecodable Encodable Decodable PartialEq Eq PartialOrd Ord Rand Show Debug Default FromPrimitive Send Sync Copy
+" dyn keyword: It's only a keyword when used inside a type expression, so
+" we make effort here to highlight it only when Rust identifiers follow it
+" (not minding the case of pre-2018 Rust where a path starting with :: can
+" follow).
+"
+" This is so that uses of dyn variable names such as in 'let &dyn = &2'
+" and 'let dyn = 2' will not get highlighted as a keyword.
+syn match rustKeyword "\<dyn\ze\_s\+\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)" contains=rustDynKeyword
+syn keyword rustDynKeyword dyn contained
+
" Number literals
syn match rustDecNumber display "\<[0-9][0-9_]*\%([iu]\%(size\|8\|16\|32\|64\|128\)\)\="
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\%([iu]\%(size\|8\|16\|32\|64\|128\)\)\="
@@ -174,7 +183,7 @@ syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE
" For the benefit of delimitMate
syn region rustLifetimeCandidate display start=/&'\%(\([^'\\]\|\\\(['nrt0\\\"]\|x\x\{2}\|u{\%(\x_*\)\{1,6}}\)\)'\)\@!/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime
-syn region rustGenericRegion display start=/<\%('\|[^[cntrl:][:space:][:punct:]]\)\@=')\S\@=/ end=/>/ contains=rustGenericLifetimeCandidate
+syn region rustGenericRegion display start=/<\%('\|[^[:cntrl:][:space:][:punct:]]\)\@=')\S\@=/ end=/>/ contains=rustGenericLifetimeCandidate
syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime
"rustLifetime must appear before rustCharacter, or chars will get the lifetime highlighting
@@ -191,11 +200,17 @@ syn region rustCommentLine star
syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell
syn region rustCommentLineDocError start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell contained
syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell
-syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell
+syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,rustCommentBlockDocNest,rustCommentBlockDocRustCode,@Spell
syn region rustCommentBlockDocError matchgroup=rustCommentBlockDocError start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,rustCommentBlockDocNestError,@Spell contained
syn region rustCommentBlockNest matchgroup=rustCommentBlock start="/\*" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell contained transparent
syn region rustCommentBlockDocNest matchgroup=rustCommentBlockDoc start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell contained transparent
syn region rustCommentBlockDocNestError matchgroup=rustCommentBlockDocError start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNestError,@Spell contained transparent
+
+if exists("b:current_syntax_embed")
+syn match rustCommentLine "^//"
+syn match rustCommentLineDoc "^//\%(//\@!\|!\)"
+endif
+
" FIXME: this is a really ugly and not fully correct implementation. Most
" importantly, a case like ``/* */*`` should have the final ``*`` not being in
" a comment, but in practice at present it leaves comments open two levels
@@ -215,6 +230,32 @@ syn keyword rustTodo contained TODO FIXME XXX NB NOTE
" FIXME: use the AST to make really good folding
syn region rustFoldBraces start="{" end="}" transparent fold
+if !exists("b:current_syntax_embed")
+ let b:current_syntax_embed = 1
+ syntax include @RustCodeInComment <sfile>:p:h/rust.vim
+ unlet b:current_syntax_embed
+
+ " We borrow the rules from rust’s src/librustdoc/html/markdown.rs, so that
+ " we only highlight as Rust what it would perceive as Rust (almost; it’s
+ " possible to trick it if you try hard, and indented code blocks aren’t
+ " supported because Markdown is a menace to parse and only mad dogs and
+ " Englishmen would try to handle that case correctly in this syntax file).
+ syn region rustCommentLinesDocRustCode matchgroup=rustCommentDocCodeFence start='^\z(\s*//[!/]\s*```\)[^A-Za-z0-9_-]*\%(\%(should_panic\|no_run\|ignore\|allow_fail\|rust\|test_harness\|compile_fail\|E\d\{4}\)\%([^A-Za-z0-9_-]\+\|$\)\)*$' end='^\z1$' keepend contains=@RustCodeInComment
+ syn region rustCommentBlockDocRustCode matchgroup=rustCommentDocCodeFence start='^\z(\%(\s*\*\)\?\s*```\)[^A-Za-z0-9_-]*\%(\%(should_panic\|no_run\|ignore\|allow_fail\|rust\|test_harness\|compile_fail\|E\d\{4}\)\%([^A-Za-z0-9_-]\+\|$\)\)*$' end='^\z1$' keepend contains=@RustCodeInComment,rustCommentBlockDocStar
+ " Strictly, this may or may not be correct; this code, for example, would
+ " mishighlight:
+ "
+ " /**
+ " ```rust
+ " println!("{}", 1
+ " * 1);
+ " ```
+ " */
+ "
+ " … but I don’t care. Balance of probability, and all that.
+ syn match rustCommentBlockDocStar /^\s*\*\s\?/ contained
+endif
+
" Default highlighting {{{1
hi def link rustDecNumber rustNumber
hi def link rustHexNumber rustNumber
@@ -246,6 +287,7 @@ hi def link rustFloat Float
hi def link rustArrowCharacter rustOperator
hi def link rustOperator Operator
hi def link rustKeyword Keyword
+hi def link rustDynKeyword rustKeyword
hi def link rustTypedef Keyword " More precise is Typedef, but it doesn't feel right for Rust
hi def link rustStructure Keyword " More precise is Structure
hi def link rustUnion rustStructure
@@ -269,7 +311,9 @@ hi def link rustCommentLineDoc SpecialComment
hi def link rustCommentLineDocError Error
hi def link rustCommentBlock rustCommentLine
hi def link rustCommentBlockDoc rustCommentLineDoc
+hi def link rustCommentBlockDocStar rustCommentBlockDoc
hi def link rustCommentBlockDocError Error
+hi def link rustCommentDocCodeFence rustCommentLineDoc
hi def link rustAssert PreCondit
hi def link rustPanic PreCondit
hi def link rustMacro Macro
@@ -282,7 +326,6 @@ hi def link rustStorage StorageClass
hi def link rustObsoleteStorage Error
hi def link rustLifetime Special
hi def link rustLabel Label
-hi def link rustInvalidBareKeyword Error
hi def link rustExternCrate rustKeyword
hi def link rustObsoleteExternMod Error
hi def link rustBoxPlacementParens Delimiter
@@ -300,4 +343,6 @@ syn sync maxlines=500
let b:current_syntax = "rust"
+" vim: set et sw=4 sts=4 ts=8:
+
endif
diff --git a/syntax/toml.vim b/syntax/toml.vim
index 7a5b44f2..1decc5fb 100644
--- a/syntax/toml.vim
+++ b/syntax/toml.vim
@@ -28,6 +28,7 @@ syn region tomlString start=/'''/ end=/'''/
hi def link tomlString String
syn match tomlInteger /\<[+-]\=[0-9]\(_\=\d\)*\>/ display
+syn match tomlInteger /\<[+-]\=\(inf\|nan\)\>/ display
hi def link tomlInteger Number
syn match tomlFloat /\<[+-]\=[0-9]\(_\=\d\)*\.\d\+\>/ display
@@ -43,16 +44,19 @@ syn match tomlDate /\d\{2\}:\d\{2\}:\d\{2\}\%(\.\d\+\)\?/ display
syn match tomlDate /\d\{4\}-\d\{2\}-\d\{2\}[T ]\d\{2\}:\d\{2\}:\d\{2\}\%(\.\d\+\)\?\%(Z\|[+-]\d\{2\}:\d\{2\}\)\?/ display
hi def link tomlDate Constant
-syn region tomlKeyDq oneline start=/"/ end=/"/ contains=tomlEscape contained
+syn match tomlKey /\v(^|[{,])\s*\zs[[:alnum:]_-]+\ze\s*\=/ display
+hi def link tomlKey Identifier
+
+syn region tomlKeyDq oneline start=/\v(^|[{,])\s*\zs"/ end=/"\ze\s*=/ contains=tomlEscape
hi def link tomlKeyDq Identifier
-syn region tomlKeySq oneline start=/'/ end=/'/ contained
+syn region tomlKeySq oneline start=/\v(^|[{,])\s*\zs'/ end=/'\ze\s*=/
hi def link tomlKeySq Identifier
-syn region tomlTable oneline start=/^\s*\[[^\[]/ end=/\]/ contains=tomlKeyDq,tomlKeySq
+syn region tomlTable oneline start=/^\s*\[[^\[]/ end=/\]/ contains=tomlKey,tomlKeyDq,tomlKeySq
hi def link tomlTable Identifier
-syn region tomlTableArray oneline start=/^\s*\[\[/ end=/\]\]/ contains=tomlKeyDq,tomlKeySq
+syn region tomlTableArray oneline start=/^\s*\[\[/ end=/\]\]/ contains=tomlKey,tomlKeyDq,tomlKeySq
hi def link tomlTableArray Identifier
syn keyword tomlTodo TODO FIXME XXX BUG contained
diff --git a/syntax/vifm.vim b/syntax/vifm.vim
index 8843d1ac..1ae9da14 100644
--- a/syntax/vifm.vim
+++ b/syntax/vifm.vim
@@ -2,7 +2,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
" vifm syntax file
" Maintainer: xaizek <xaizek@posteo.net>
-" Last Change: April 30, 2018
+" Last Change: July 4, 2018
" Inspired By: Vim syntax file by Dr. Charles E. Campbell, Jr.
if exists('b:current_syntax')
@@ -76,8 +76,9 @@ syntax keyword vifmHiGroups contained WildMenu Border Win CmdLine CurrLine
\ OtherLine Directory Link Socket Device Executable Selected BrokenLink
\ TopLine TopLineSel StatusLine JobLine SuggestBox Fifo ErrorMsg CmpMismatch
\ AuxWin TabLine TabLineSel
-syntax keyword vifmHiStyles contained bold underline reverse inverse standout
- \ none
+ \ User1 User2 User3 User4 User5 User6 User7 User8 User9
+syntax keyword vifmHiStyles contained
+ \ bold underline reverse inverse standout italic none
syntax keyword vifmHiColors contained black red green yellow blue magenta cyan
\ white default lightblack lightred lightgreen lightyellow lightblue
\ lightmagenta lightcyan lightwhite Grey0 NavyBlue DarkBlue Blue3 Blue3_2
@@ -233,7 +234,7 @@ syntax region vifmExecute start='!' skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='$'
syntax region vifmMapArgs start='\ze\S\+'
\ end='\ze.' skip='\(\n\s*\\\)\|\(\n\s*".*$\)'
\ contained
- \ nextgroup=vifmMapLhs
+ \ nextgroup=vifmMapArgList
syntax region vifmCMapArgs start='\S\+'
\ end='\n\s*\\' skip='\(\n\s*\\\)\|\(\n\s*".*$\)'
\ contained
@@ -381,6 +382,9 @@ syntax region vifmArgument contained start=+'+ skip=+\\\\\|\\'\|''+ end=+'+
syntax match vifmEnvVar contained /\$[0-9a-zA-Z_]\+/
syntax match vifmNumber contained /\d\+/
+" Optional map arguments right after command name
+syntax match vifmMapArgList '\(<silent>\s*\)*' contained nextgroup=vifmMapLhs
+
" Ange-bracket notation
syntax case ignore
syntax match vifmNotation '<\(esc\|cr\|space\|del\|nop\|\(s-\)\?tab\|home\|end\|left\|right\|up\|down\|bs\|delete\|insert\|pageup\|pagedown\|\([acms]-\)\?f\d\{1,2\}\|c-s-[a-z[\]^_]\|s-c-[a-z[\]^_]\|c-[a-z[\]^_]\|[am]-c-[a-z]\|c-[am]-[a-z]\|[am]-[a-z]\)>'
@@ -391,7 +395,7 @@ syntax region vifmComment contained contains=@Spell start='^\(\s\|:\)*"' end='$'
" Comment at the end of a line
syntax match vifmInlineComment contained contains=@Spell '\s"[^"]*$'
" This prevents highlighting non-first line of multi-line command
-syntax match vifmNotComment contained '\s"[^"]*\(\(\n\s*\(\\\|"\)\)\@!\|$\)'
+syntax match vifmNotComment contained '\s"[^"]*\(\n\s*\(\\\|"\)\)\@='
" Empty line
syntax match vifmEmpty /^\s*$/
@@ -435,6 +439,7 @@ highlight link vifmHiStyles PreProc
highlight link vifmHiColors Special
highlight link vifmOption PreProc
highlight link vifmNotation Special
+highlight link vifmMapArgList Special
highlight link vifmString String
highlight link vifmStringInExpr String
highlight link vifmEnvVar PreProc