hacky Vim syntax highlighting for Mu Lisp

This commit is contained in:
Kartik K. Agaram 2021-06-06 15:09:32 -07:00
parent c1fff5ec14
commit 1116288871
2 changed files with 34 additions and 1 deletions

33
editor/mulisp.vim Normal file
View File

@ -0,0 +1,33 @@
" Vim syntax file
" Language: Mu Lisp
" Maintainer: Kartik Agaram <mu@akkartik.com>
" URL: http://github.com/akkartik/mu
" License: public domain
"
" Copy this file into your ftplugin directory, and add the following to your
" vimrc or to .vim/ftdetect/mulisp.vim:
" autocmd BufReadPost,BufNewFile *.limg set filetype=mulisp
let s:save_cpo = &cpo
set cpo&vim
setlocal iskeyword=@,48-57,?,!,_,$
" Hack: I define new syntax groups here, and I don't know how to distribute
" colorscheme-independent color suggestions for them.
highlight Normal ctermfg=245
highlight MuLispNormal ctermfg=0
highlight muLispKeyword ctermfg=2
syntax region String start=+"+ skip=+\\"+ end=+"+
syntax region muLispNormal matchgroup=Normal start=/\[/ end=/\]/ contains=muLispLiteral,muLispComment,muLispDelimiter
syntax match muLispComment /#.*/ contained | highlight link muLispComment Comment
syntax match muLispLiteral /\<[0-9]\+\>/ contained | highlight link muLispLiteral Constant
syntax match muLispLiteral /\[[^\]]*\]/ contained
syntax match muLispDelimiter /[(),@`]/ contained | highlight link muLispDelimiter Delimiter
syntax keyword muLispKeyword globals sandbox
let &cpo = s:save_cpo

View File

@ -97,4 +97,4 @@ inoremap <Leader>o <Esc>F<Space>a(offset <Esc>A)
inoremap ,- <-
inoremap -. ->
autocmd BufReadPost,BufNewFile *.limg call matchadd('String', '\[\([^\]]*\_$\_s\)*[^\]]*\]')
autocmd BufReadPost,BufNewFile *.limg set filetype=mulisp |call matchadd('String', '\[\([^\]]*\_$\_s\)*[^\]]*\]')