Vim config files for Kyn highlighting

This commit is contained in:
2025-10-06 11:51:45 +11:00
parent b628c00f9e
commit e3b24b585b
2 changed files with 48 additions and 0 deletions

1
.vim/ftdetect/kyn.vim Normal file
View File

@@ -0,0 +1 @@
autocmd BufNewFile,BufRead *.kyn setfiletype kyn

47
.vim/syntax/kyn.vim Normal file
View File

@@ -0,0 +1,47 @@
" Vim syntax file
" Language: Kyn
if exists("b:current_syntax")
finish
endif
" Keywords
syn keyword kynKeyword fun struct let if while return assert is
" Instructions/Modules
syn keyword kynInstruction println print math exit compare input concat split file
" Comments
syn match kynComment /#.*/
" Strings
syn region kynString start=/"/ end=/"/
" Numbers
syn match kynNumber /\d\+\(\.\d\+\)\?/
" Variables
syn match kynVariable /\$[a-zA-Z_][a-zA-Z0-9_]*/
" Type Placeholders
syn match kynType /<[a-zA-Z_][a-zA-Z0-9_]*>/
" Operators
syn match kynOperator /[=+\-*\/^%]/
syn match kynOperator /==\|!=\|>=\|<=/
" Special variables
syn keyword kynSpecial self
" Highlighting links
hi def link kynKeyword Keyword
hi def link kynInstruction Statement
hi def link kynComment Comment
hi def link kynString String
hi def link kynNumber Number
hi def link kynVariable Identifier
hi def link kynType Type
hi def link kynOperator Operator
hi def link kynSpecial Special
let b:current_syntax = "kyn"