much love
[mu.git] / editor / subx.vim
blob6a5f9f16e7d33edbc19cd89bac87fbc8e9063a7d
1 " SubX syntax file
2 " Language:    SubX
3 " Maintainer:  Kartik Agaram <mu@akkartik.com>
4 " URL:         https://github.com/akkartik/mu
5 " License:     public domain
7 " Copy this file into your ftplugin directory, and add the following to your
8 " vimrc or to .vim/ftdetect/subx.vim:
9 "   autocmd BufReadPost,BufNewFile *.subx set filetype=subx
11 " Some highlight groups you might want to select colors for in your vimrc:
12 highlight link CommentedCode Comment
13 highlight link SalientComment Comment
14 highlight link subxFunction Identifier
15 highlight link subxMinorFunction Identifier
16 highlight link subxTest Identifier
17 highlight link subxH1Comment Comment
18 highlight link subxComment Comment
19 highlight link subxS1Comment Comment
20 highlight link subxS2Comment Comment
21 " Some suggestions for 256-color terminals to add to your vimrc:
22 "   blue tones
23 "     highlight subxH1Comment cterm=underline ctermfg=27
24 "     highlight subxComment ctermfg=27
25 "     highlight subxS1Comment ctermfg=19
26 "     highlight subxS2Comment ctermfg=245
27 "   blue-green tones
28 "     highlight subxH1Comment cterm=underline ctermfg=25
29 "     highlight subxComment ctermfg=25
30 "     highlight subxS1Comment ctermfg=19
31 "     highlight subxS2Comment ctermfg=245
32 "   grey tones
33 "     highlight subxH1Comment cterm=bold,underline
34 "     highlight subxComment cterm=bold ctermfg=236
35 "     highlight subxS1Comment cterm=bold ctermfg=242
36 "     highlight subxS2Comment ctermfg=242
38 let s:save_cpo = &cpo
39 set cpo&vim
41 " setlocal iskeyword=@,48-57,?,!,_,$,-
42 setlocal formatoptions-=t  " allow long lines
43 setlocal formatoptions+=c  " but comments should still wrap
45 setlocal iskeyword+=-,?,<,>,$,@
47 syntax match subxH1Comment /# - .*/ | highlight link subxH1Comment Comment
48 syntax match subxComment /#\( \.\| - \|? \)\@!.*/ | highlight link subxComment Comment
49 syntax match subxS1Comment /# \..*/ | highlight link subxS1Comment Comment
50 syntax match subxS2Comment /# \. \..*/ | highlight link subxS2Comment Comment
52 set comments-=:#
53 set comments+=n:#
54 syntax match subxCommentedCode "#? .*"  | highlight link subxCommentedCode CommentedCode | highlight link CommentedCode Comment
55 let b:cmt_head = "#? "
57 " comment token
58 syntax match subxDelimiter / \. /  | highlight link subxDelimiter Normal
60 syntax match subxString %"[^"]*"% | highlight link subxString Constant
62 "" definitions
63 " match globals but not registers like 'EAX'
64 " don't match capitalized words in metadata
65 " don't match inside strings
66 syntax match subxGlobal %\(/\)\@<!\<[A-Z][a-z0-9_-]*\>% | highlight link subxGlobal SpecialChar
68 " functions but not tests, globals or internal functions
69 syntax match subxFunction "^\(test_\)\@<![a-z][^ ]*\(:\)\@=" | highlight link subxFunction Function
70 " tests starting with 'test-'; dark:34 light:64
71 syntax match subxTest "^test-[^ ]*\(:\)\@=" | highlight link subxTest Typedef
72 " internal functions starting with '_'
73 syntax match subxMinorFunction "^_[^ ]*\(:\)\@=" | highlight link subxMinorFunction Ignore
74 " other internal labels starting with '$'
75 syntax match subxLabel "^\$[^ ]*\(:\)\@=" | highlight link subxLabel Constant
77 syntax keyword subxControl break loop | highlight link subxControl Constant
79 let &cpo = s:save_cpo