about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-02-28 11:19:53 -0800
committerKartik Agaram <vc@akkartik.com>2020-02-28 11:19:53 -0800
commiteaeb43de2ebf4979cbb5e5afcb62b410e82715ab (patch)
tree005bf6e77fa1651ec575572c517e4b355a81105f
parente62702efd094487ec0187c984d4e38303112b803 (diff)
downloadmu-eaeb43de2ebf4979cbb5e5afcb62b410e82715ab.tar.gz
6067
Missed the file.
-rw-r--r--mu.vim58
1 files changed, 58 insertions, 0 deletions
diff --git a/mu.vim b/mu.vim
new file mode 100644
index 00000000..c83b391b
--- /dev/null
+++ b/mu.vim
@@ -0,0 +1,58 @@
+" Vim syntax file
+" Language:    mu
+" Maintainer:  Kartik Agaram <mu@akkartik.com>
+" URL:         http://github.com/akkartik/mu
+" License:     public domain
+"
+" Copy this into your ftplugin directory, and add the following to your vimrc
+" or to .vim/ftdetect/mu.vim:
+"   autocmd BufReadPost,BufNewFile *.mu set filetype=mu
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+" todo: why does this periodically lose syntax, like on file reload?
+"   $ vim x.mu
+"   :e
+"? if exists("b:syntax")
+"?   finish
+"? endif
+"? let b:syntax = "mu"
+
+setlocal iskeyword=@,48-57,?,!,_,$,-
+setlocal formatoptions-=t  " Mu programs have long lines
+setlocal formatoptions+=c  " but comments should still wrap
+
+syntax match muComment /#.*$/  | highlight link muComment Comment
+syntax match muSalientComment /##.*$/  | highlight link muSalientComment SalientComment
+set comments+=n:#
+syntax match muCommentedCode "#? .*"  | highlight link muCommentedCode CommentedCode
+let b:cmt_head = "#? "
+
+syntax match muDelimiter "[{}]"  | highlight link muDelimiter Delimiter
+
+" Mu literals
+syntax match muLiteral %\<[0-9-]\?[0-9]\+/[^ ,]*%
+highlight link muLiteral Constant
+
+" sources of action at a distance
+syntax match muAssign "<-"
+highlight link muAssign SpecialChar
+
+" common keywords
+" use regular expressions for common words that may come after '/'
+syntax match muControl "^return\>\| return\>"
+syntax match muControl "\<jump\>\|\<jump-if[^ ]*"
+syntax match muControl "\<break\>\|\<break-if[^ ]*"
+syntax match muControl "\<loop\>\|\<loop-if[^ ]*"
+highlight link muControl Identifier
+
+syntax match muRecipe " -> "
+syntax keyword muRecipe fn type
+highlight link muRecipe PreProc
+
+syntax match muData "^type\>"
+syntax match muData "\<eax\>\|\<ecx\>\|\<edx\>\|\<ebx\>\|\<esi\>\|\<edi\>"
+highlight link muData Constant
+
+let &cpo = s:save_cpo