mu/subx/subx.vim

43 lines
1.7 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+=-
"? syntax match subxComment /#.*$/ | highlight link subxComment Comment
"? syntax match subxSalientComment /##.*$/ | highlight link subxSalientComment SalientComment
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
syntax match subxH1Comment /# -.*/ | highlight subxH1Comment ctermfg=14
syntax match subxComment /#[^ ].*\|# [^.-].*\|# \?$/ | highlight subxComment ctermfg=39
syntax match subxS1Comment /# \..*/ | highlight subxS1Comment ctermfg=27
syntax match subxS2Comment /# \. \..*/ | highlight subxS2Comment ctermfg=19
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-11-25 04:54:56 +00:00
" match globals but not registers like 'EAX'
syntax match subxGlobal %[^/]\<[A-Z][a-z0-9_-]*\>\|^[A-Z][a-z0-9_-]*\>% | highlight link subxGlobal SpecialChar
"? 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=196
2018-08-13 03:26:53 +00:00
let &cpo = s:save_cpo