vim: add operator symbols and keywords

This commit is contained in:
2026-05-24 20:26:29 +01:00
parent 446ee99306
commit bb09e8b8d1
+29 -5
View File
@@ -7,9 +7,11 @@ set cpoptions&vim
setlocal iskeyword+=-
syn match bshellFunctionRef /\<[A-Za-z][A-Za-z0-9]*\(-[A-Za-z0-9][A-Za-z0-9]*\)\+\>/
syn match bshellVariable /\$[A-Za-z][A-Za-z0-9_]*/
syn match bshellVariable /\$[A-Za-z_][A-Za-z0-9_]*/
syn match bshellArgFlag /\<-[A-Za-z][A-Za-z0-9]*\(-[A-Za-z0-9][A-Za-z0-9]*\)*\>/
syn keyword bshellKeyword func
syn keyword bshellKeyword func if elseif else
syn keyword bshellBuiltinCommand echo
syn keyword bshellTodo contained TODO FIXME XXX NOTE HACK TBD
syn match bshellLineComment /#.*$/ contains=bshellTodo
@@ -33,16 +35,33 @@ syn case match
syn cluster bshellNumber contains=bshellInteger,bshellReal
syn cluster bshellLiteral contains=@bshellNumber,@bshellString
syn cluster bshellAll contains=@bshellLiteral,bshellVariable,bshellKeyword,bshellArgFlag,bshellFunctionRef,bshellSymbolOp,bshellKeywordOp
syn cluster bshellAll contains=
\ @bshellLiteral,bshellVariable,bshellKeyword,bshellArgFlag,
\ bshellFunctionRef,bshellBuiltinCommand,bshellSymbolOp,
\ bshellKeywordOp,bshellTerminator,bshellControlSymbols,
\ bshellBraces,bshellParens,bshellStructureDelimiter
syn match bshellSymbolOp "[+]" display
syn keyword bshellKeywordOp is not understands and or
syn match bshellBraces "[{}]" display
syn match bshellParens "[()]" display
syn match bshellStructureDelimiter "@[{(]" display
syn match bshellControlSymbols "[[\]]" display
syn match bshellControlSymbols "|" display
syn match bshellSymbolOp "\*" display
syn match bshellSymbolOp "[\/*%&!,]" display
syn match bshellSymbolOp "[+\-/*%!]=" display
syn match bshellSymbolOp "\s\+[\-+]\s\+" display
syn match bshellTerminator "[;]" display
syn keyword bshellKeywordOp -f -band -bor -bxor -bnot -shl -shr
\ -eq -ne -gt -lt -ge -le -match -notmatch -replace
\ -like -notlike -in -notin -contains -notcontains
\ -and -or -xor -not -split -join -is -isnot -as
hi def link bshellKeyword Statement
hi def link bshellArgFlag Tag
hi def link bshellVariable Identifier
hi def link bshellLineComment Comment
hi def link bshellFunctionRef Function
hi def link bshellBuiltinCommand Function
hi def link bshellString String
hi def link bshellInterpolatedString String
hi def link bshellLiteralString String
@@ -50,8 +69,13 @@ hi def link bshellInteger Number
hi def link bshellReal Float
hi def link bshellInterpolationDelimiter Delimiter
hi def link bshellStructureDelimiter Delimiter
hi def link bshellBraces Delimiter
hi def link bshellParens Delimiter
hi def link bshellControlSymbols Operator
hi def link bshellSymbolOp Operator
hi def link bshellKeywordOp Operator
hi def link bshellTerminator Delimiter
" The default highlighting.
" hi def link bshellUnspecifiedStatement Statement