commit 0ebd3ec36dd97dbc814df2100d116a6fb5daa81b
parent 4f85f32d72d2a1c6b2463aff934ab49e1da94b92
Author: Brian Swetland <swetland@frotz.net>
Date: Sat, 14 Oct 2023 00:36:01 -0700
vim: syntax highlighting support
Diffstat:
3 files changed, 64 insertions(+), 0 deletions(-)
diff --git a/vim/ftdetect/spl.vim b/vim/ftdetect/spl.vim
@@ -0,0 +1 @@
+autocmd BufNewFile,BufRead *.spl setfiletype spl
diff --git a/vim/ftplugin/spl.vim b/vim/ftplugin/spl.vim
@@ -0,0 +1,4 @@
+setlocal commentstring=//\ %s
+setlocal tabstop=4
+setlocal softtabstop=4
+setlocal shiftwidth=4
diff --git a/vim/syntax/spl.vim b/vim/syntax/spl.vim
@@ -0,0 +1,59 @@
+
+if exists("b:current_syntax")
+ finish
+endif
+
+let b:current_syntax = "spl"
+
+syntax case match
+
+syntax match splNumber "\v<\d+>"
+syntax match splNumber "\v<0x\x+>"
+syntax match splNumber "\v<0b[01]+>"
+
+" floating point
+" syntax match splNumber "\v<\d+\.\d+>"
+" syntax match splNumber "\v<\d*\.?\d+([Ee]-?)?\d+>"
+" syntax match splNumber "\v<0x\x+([Pp]-?)?\x+>"
+
+syntax keyword splStatement return break continue
+syntax keyword splCond if else
+syntax keyword splLoop while for
+syntax keyword splDef fn var struct enum
+syntax keyword splType u8 u32 i32 str bool
+syntax keyword splConstant nil
+syntax keyword splBool true false
+
+syntax match splEscape display contained "\v\\[nt\\\'\"]"
+syntax match splEscHex display contained "\v\\x\x{2}"
+syntax region splString start=/"/ skip=/\\"/ end=/"/ oneline contains=splEscape,splEscHex
+syntax region splChar start=/'/ skip=/\\'/ end=/'/ oneline contains=splEscape,splEscHex
+
+syntax keyword splTodo contained TODO FIXME XXX
+syntax region splComment start="//" end="$" contains=splTodo
+
+syntax region splParen start='(' end=')' transparent
+syntax region splBlock start="{" end="}" transparent
+
+syntax keyword splBuiltin _hexout_
+
+" map language-specifc names to standard highlight names
+highlight default link splNumber Number
+
+highlight default link splStatement Statement
+highlight default link splCond Conditional
+highlight default link splLoop Repeat
+highlight default link splDef Keyword
+highlight default link splType Type
+highlight default link splConstant Constant
+highlight default link splBool Boolean
+
+highlight default link splString String
+highlight default link splChar Character
+
+highlight default link splTodo Todo
+highlight default link splComment Comment
+
+highlight default link splBuiltin Identifier
+
+" highlight default link splOperator Operator