mu/subx/subx.vim

69 lines
2.9 KiB
VimL
Raw Normal View History

" SubX syntax file
" Language: SubX
" Maintainer: Kartik Agaram <mu@akkartik.com>
" URL: https://github.com/akkartik/mu
" License: public domain
"
" Copy this into your ftplugin directory, and add the following to your vimrc
" or to .vim/ftdetect/subx.vim:
" autocmd BufReadPost,BufNewFile *.subx set filetype=subx
let s:save_cpo = &cpo
set cpo&vim
" setlocal iskeyword=@,48-57,?,!,_,$,-
setlocal formatoptions-=t " allow long lines
setlocal formatoptions+=c " but comments should still wrap
setlocal iskeyword+=-
" blue tones
2018-12-15 07:44:59 +00:00
" comment colors for dark terminal: 14, 39, 27, 19
" comment colors for light terminal: 19, 27, 39, 6
"? syntax match subxH1Comment /# - .*/ | highlight subxH1Comment cterm=underline ctermfg=27
"? syntax match subxComment /#[^ ].*\|# [^.-].*\|# \?$/ | highlight subxComment ctermfg=27
"? syntax match subxS1Comment /# \..*/ | highlight subxS1Comment ctermfg=19
"? syntax match subxS2Comment /# \. \..*/ | highlight subxS2Comment ctermfg=245
" blue-green tones
syntax match subxH1Comment /# - .*/ | highlight subxH1Comment cterm=underline ctermfg=25
2018-12-28 10:18:16 +00:00
syntax match subxComment /#\( \.\| - \|? \)\@!.*/ | highlight subxComment ctermfg=25
syntax match subxS1Comment /# \..*/ | highlight subxS1Comment ctermfg=19
syntax match subxS2Comment /# \. \..*/ | highlight subxS2Comment ctermfg=245
" grey tones
"? syntax match subxH1Comment /# - .*/ | highlight subxH1Comment cterm=bold,underline
"? syntax match subxComment /#[^ ].*\|# [^.-].*\|# \?$/ | highlight subxComment cterm=bold ctermfg=236
"? hi Normal ctermfg=236
"? syntax match subxS1Comment /# \..*/ | highlight subxS1Comment cterm=bold ctermfg=242
"? syntax match subxS2Comment /# \. \..*/ | highlight subxS2Comment ctermfg=242
2018-11-30 17:43:49 +00:00
2018-07-01 06:05:10 +00:00
set comments-=:#
set comments+=n:#
syntax match subxCommentedCode "#? .*" | highlight link subxCommentedCode CommentedCode
let b:cmt_head = "#? "
2018-08-05 04:21:19 +00:00
" comment token
2018-11-30 17:43:49 +00:00
syntax match subxDelimiter / \. / | highlight link subxDelimiter CommentedCode
syntax match subxString %"[^"]*"% | highlight link subxString Constant
2018-12-02 20:49:15 +00:00
"" definitions
2018-11-25 04:54:56 +00:00
" match globals but not registers like 'EAX'
2018-12-01 04:01:41 +00:00
" don't match capitalized words in metadata
" don't match inside strings
syntax match subxGlobal %\(/\)\@<!\<[A-Z][a-z0-9_-]*\>% | highlight link subxGlobal SpecialChar
4805 More tweaking of colors, as far as possible in 256-color terminal mode that's almost entirely just for me, and beyond that in the generated html that more people may look at. In the former I have to work with a limited palette, while I'd like the latter to be more accessible for others. Evolution of colors: === 1 .subxH1Comment { color: #00ffff; } .subxH2Comment { color: #00afff; } .subxComment { color: #00afff; } .subxS1Comment { color: #0080ff; } .subxS2Comment { color: #0040ff; } === 2 sed -i 's/^\.subxH1Comment.*/.subxH1Comment { color:#00ffff; }/' $1.html sed -i 's/^\.subxH2Comment.*/.subxH2Comment { color:#00bbff; }/' $1.html sed -i 's/^\.subxComment.*/.subxComment { color:#00bbff; }/' $1.html sed -i 's/^\.subxS1Comment.*/.subxS1Comment { color:#0098ff; }/' $1.html sed -i 's/^\.subxS2Comment.*/.subxS2Comment { color:#0070ff; }/' $1.html # slightly too dark === 3: http://www.perbang.dk/rgbgradient from start to end sed -i 's/^\.subxH1Comment.*/.subxH1Comment { color:#00ffff; }/' $1.html sed -i 's/^\.subxH2Comment.*/.subxH2Comment { color:#00ddff; }/' $1.html sed -i 's/^\.subxComment.*/.subxComment { color:#00bbff; }/' $1.html sed -i 's/^\.subxS1Comment.*/.subxS1Comment { color:#0099ff; }/' $1.html sed -i 's/^\.subxS2Comment.*/.subxS2Comment { color:#0078ff; }/' $1.html === 4: drop down to 4 colors sed -i 's/^\.subxH1Comment.*/.subxH1Comment { color:#00ffff; }/' $1.html sed -i 's/^\.subxComment.*/.subxComment { color:#00d2ff; }/' $1.html sed -i 's/^\.subxS1Comment.*/.subxS1Comment { color:#00a4ff; }/' $1.html sed -i 's/^\.subxS2Comment.*/.subxS2Comment { color:#0078ff; }/' $1.html === 4: make final one just a little too dark sed -i 's/^\.subxH1Comment.*/.subxH1Comment { color:#00ffff; }/' $1.html sed -i 's/^\.subxComment.*/.subxComment { color:#00cfff; }/' $1.html sed -i 's/^\.subxS1Comment.*/.subxS1Comment { color:#009fff; }/' $1.html sed -i 's/^\.subxS2Comment.*/.subxS2Comment { color:#0070ff; }/' $1.html # slightly too dark === 5: make darkest shade a little less blue, just at the edge of too dark sed -i 's/^\.subxH1Comment.*/.subxH1Comment { color:#00ffff; }/' $1.html sed -i 's/^\.subxComment.*/.subxComment { color:#16ccff; }/' $1.html sed -i 's/^\.subxS1Comment.*/.subxS1Comment { color:#2d99ff; }/' $1.html sed -i 's/^\.subxS2Comment.*/.subxS2Comment { color:#4466ff; }/' $1.html # slightly too dark === 6: HSV gradient between the same endpoints sed -i 's/^\.subxH1Comment.*/.subxH1Comment { color:#00ffff; }/' $1.html sed -i 's/^\.subxComment.*/.subxComment { color:#16bfff; }/' $1.html sed -i 's/^\.subxS1Comment.*/.subxS1Comment { color:#2d8cff; }/' $1.html sed -i 's/^\.subxS2Comment.*/.subxS2Comment { color:#4466ff; }/' $1.html # slightly too dark
2018-11-30 22:20:37 +00:00
" tweak the red color from the colorscheme just a tad to improve contrast
highlight SpecialChar ctermfg=160
2018-12-02 20:49:15 +00:00
" functions but not tests, globals or internal functions
2018-12-28 07:17:34 +00:00
syntax match subxFunction "^\(test_\)\@<![a-z][^ ]*\(:\)\@=" | highlight subxFunction cterm=underline ctermfg=130
2018-12-15 07:44:59 +00:00
" tests starting with 'test-'; dark:34 light:64
syntax match subxTest "^test-[^ ]*\(:\)\@=" | highlight subxTest ctermfg=64
2018-12-02 20:49:15 +00:00
" internal functions starting with '_'
syntax match subxMinorFunction "^_[^ ]*\(:\)\@=" | highlight subxMinorFunction ctermfg=95
2018-12-02 20:49:15 +00:00
" other internal labels starting with '$'
syntax match subxLabel "^\$[^ ]*\(:\)\@=" | highlight link subxLabel Constant
2018-12-02 20:49:15 +00:00
2018-08-13 03:26:53 +00:00
let &cpo = s:save_cpo