vim: add support for word operators, package/use identifier highlighting, slashes in atom names

This commit is contained in:
2024-11-10 12:23:44 +00:00
parent 839259cdd7
commit 712bdd3e76

View File

@@ -4,6 +4,7 @@ endif
let s:save_cpo = &cpoptions
set cpoptions&vim
setlocal iskeyword+=:
syn keyword ivyType Object Int Enum Bool Iterator Lambda Selector Package String Exception Tuple
syn match ivyType /\<[A-Z]\{1,2\}\([a-z0-9]\+[A-Z]\{0,2\}\)*\>/
@@ -14,11 +15,12 @@ syn keyword ivyConditional if elif else unless match
syn match ivySelectorLabel /\<[a-z]\([A-Za-z0-9_]\+\)\:/
syn match ivyUnnamedVariable /\<_\>/
syn match ivyAtomName /#[a-z][a-z0-9_:]*\>/
syn match ivyAtomName /#[a-z][a-z0-9_:/]*\>/
syn match ivyComplexMessageName /\<\zs[A-Za-z][A-Za-z0-9]\+\ze(/
"syn match ivyUnaryMessageName /-\s*[a-zA-z][a-zA-Z0-9_]\+\s*\n/
syn match ivyUnaryMessageName /\(-\s*\)\@<=[a-z][A-Za-z0-9_]*\(\s*\n\)\@=/
syn match ivyUnaryMessageName /\(-\s*\)\@<=[a-z][A-Za-z0-9_]*\(\s*|\)\@=/
syn match ivyPropertyName /\($\s*\)\@<=[a-z][A-Za-z0-9_]*/
syn match ivyLineContinuation /\\\n/
@@ -30,6 +32,9 @@ syn keyword ivyBuiltinVar self error cout cin cerr
syn keyword ivyUnspecifiedStatement end package use as then do get set
syn match ivyPackageStmtIdentifier /\(package \)\@<=\([A-Za-z_][A-Za-z0-9_]*\)\(.\([A-Za-z_][A-Za-z0-9_]*\)\)*\(\n\)\@=\>/
syn match ivyUseStmtIdentifier /\(use \)\@<=\([A-Za-z_][A-Za-z0-9_]*\)\(.\([A-Za-z_][A-Za-z0-9_]*\)\)*\(\n\)\@=\>/
" Operators/Punctuation
syn match ivyBraces "[{}]" display
syn match ivyBrackets "[[\]]" display
@@ -45,6 +50,9 @@ syn match ivyLambdaSymbols "|" display
syn match ivyLogicSymbols "&&" display
syn match ivyLogicSymbols "||" display
syn match ivyPropertySymbol "\$" display
syn match ivyStatementSeparator "\.\s*" display
syn match ivyMessageTerminator "\!\s*" display
syn keyword ivyWordOperator is not understands and or
" PROVIDES: @ivyCommentHook
syn keyword ivyTodo contained TODO FIXME XXX NOTE HACK TBD
@@ -162,6 +170,7 @@ hi def link ivyTypeOfError Error
hi def link ivyOpSymbols Operator
hi def link ivyOtherSymbols Structure
hi def link ivyLogicSymbols Operator
hi def link ivyWordOperator Operator
hi def link ivySpecialError Error
hi def link ivySpecialCharError Error
@@ -195,6 +204,13 @@ hi def link ivyUnaryMessageName Function
hi def link ivyPropertyName @property
hi def link ivyPropertySymbol Statement
hi def link ivyStatementSeparator Comment
hi def link ivyMessageTerminator @punctuation.special
hi def link ivyPackageStmtIdentifier @string.special.url
hi def link ivyUseStmtIdentifier @module
let b:current_syntax = 'ivy'
let &cpoptions = s:save_cpo