Skip to content

Commit c0a5e4c

Browse files
chris-morganamadeus
authored andcommitted
Make a distinct group for keyword operators
In the stock Vim javascript syntax file, `new`, `delete`, `instanceof` and `typeof` belong to syntax group `javaScriptOperator`, while symbol operators have no syntax group. But this package was highlighting keyword and symbol operators alike. With this change, users can choose to return to highlighting keyword but not symbol operators, with this in their `after/syntax/javascript.vim`: hi link jsOperatorKeyword Operator hi clear jsOperator
1 parent ddaa14d commit c0a5e4c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

syntax/javascript.vim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ syntax match jsParensError /[)}\]]/
3333
" Program Keywords
3434
syntax keyword jsStorageClass const var let skipwhite skipempty nextgroup=jsDestructuringBlock,jsDestructuringArray,jsVariableDef
3535
syntax match jsVariableDef contained /\<\K\k*/ skipwhite skipempty nextgroup=jsFlowDefinition
36-
syntax keyword jsOperator delete instanceof typeof void new in of skipwhite skipempty nextgroup=@jsExpression
36+
syntax keyword jsOperatorKeyword delete instanceof typeof void new in of skipwhite skipempty nextgroup=@jsExpression
3737
syntax match jsOperator "[-!|&+<>=%/*~^]" skipwhite skipempty nextgroup=@jsExpression
3838
syntax match jsOperator /::/ skipwhite skipempty nextgroup=@jsExpression
3939
syntax keyword jsBooleanTrue true
@@ -230,7 +230,7 @@ if exists("javascript_plugin_flow")
230230
runtime extras/flow.vim
231231
endif
232232

233-
syntax cluster jsExpression contains=jsBracket,jsParen,jsObject,jsTernaryIf,jsTaggedTemplate,jsTemplateString,jsString,jsRegexpString,jsNumber,jsFloat,jsOperator,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
233+
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
234234
syntax cluster jsAll contains=@jsExpression,jsStorageClass,jsConditional,jsRepeat,jsReturn,jsException,jsTry,jsNoise,jsBlockLabel
235235

236236
" Define the default highlighting.
@@ -290,6 +290,7 @@ if version >= 508 || !exists("did_javascript_syn_inits")
290290
HiLink jsArguments Special
291291
HiLink jsError Error
292292
HiLink jsParensError Error
293+
HiLink jsOperatorKeyword jsOperator
293294
HiLink jsOperator Operator
294295
HiLink jsOf Operator
295296
HiLink jsStorageClass StorageClass

0 commit comments

Comments
 (0)