vim: add pikchr syntax highlighting it's very poor, but kinda works.
la-ninpre leobrekalini@gmail.com
Mon, 14 Dec 2020 02:06:35 +0300
2 files changed,
90 insertions(+),
0 deletions(-)
A
.config/nvim/ftdetect/pikchr.vim
@@ -0,0 +1,1 @@
+autocmd BufRead,BufNewFile *.pikchr set filetype=pikchr
A
.config/nvim/syntax/pikchr.vim
@@ -0,0 +1,89 @@
+" Vim syntax file +" Language: Pikchr +" Mantainer: la-ninpre +" Latest Revision: 14 Dec 2020 + +" check if syntax highlighting is not in conflict +if exists("b:current_syntax") + finish +endif + +""" syntax block + +" keywords +syntax keyword PikchrStatement print assert +syntax keyword PikchrExprFunc abs cos dist int max min sin sqrt +syntax keyword PikchrObject arc arrow box circle cylinder dot ellipse file line +syntax keyword PikchrObject move oval spline text +syntax keyword PikchrDirection right down left up +syntax keyword PikchrDirection n north ne e east se s south sw w west nw +syntax keyword PikchrPlace of in vertex +syntax keyword PikchrAttribute dashed dotted color fill behind cw ccw +syntax keyword PikchrAttribute thick thin solid chop fit +syntax keyword PikchrTextAttr above aligned below big small bold italic +syntax keyword PikchrTextAttr center ljust rjust +syntax keyword PikchrLocAttr at with +syntax keyword PikchrNumPropty diameter ht height rad radius thickness width wid +syntax keyword PikchrNthObj last previous +syntax keyword PikchrOperator + - * / + +" define stmt +syntax match PikchrDefineStmt "^define\s\i\+" contains=PikchrCustomObject +syntax keyword PikchrDefine define contained +syntax match PikchrCustomObject "\i\+" contained + +" literals +syntax match PikchrComment "\v(#.*$)|(/\*.*\*/)" +syntax match PikchrString "\".*\"" +syntax match PikchrVariable "\v\i+\s?(\*|\+|-|/)?\=" +syntax match PikchrDollVar "\$\i\+" +syntax match PikchrLabel "\u\w*" +syntax match PikchrNumber "\v\.?\d+(\.\d+)?(\%|in|cm|px|pt|pc|mm)?" +syntax match PikchrNumber "\v0x\x+" +syntax match PikchrOrdinal "\v([^0]\d+(st|nd|rd|th))|first" + +" matches +syntax match PikchrAttributeSup "\v<same(\sas)?>" +syntax match PikchrAttributeSup "\v<invis(ible)?>" +syntax match PikchrAttributeSup "\v\<-\>?|-\>" +syntax match PikchrPosition "(((of\sthe\s)\?\sway\s)\?between)|and" +syntax match PikchrDotEdgename "\v\.((n(orth)?)|(e(ast)?)|(s(outh)?)|(w(est)?)|se|se|nw|ne)" +syntax match PikchrDotEdgename "\v\.(bot(tom)?|t(op)?|right|left|start|end|c(enter)?)" +syntax match PikchrDotPropty "\v\.(color|dashed|diameter|dotted|fill|ht|height|rad(ius)?|thickness|wid(th)?)" +syntax match PikchrPathElem "\v<(from|then|go|to|(until\s)?even\swith|heading|close)>" + + +""" highlight block + +" keywords +hi def link PikchrStatement Statement +hi def link PikchrExprFunc Function +hi def link PikchrObject Type +hi def link PikchrDirection Function +hi def link PikchrLocAttr Tag +hi def link PikchrPlace Function +hi def link PikchrTextAttr Identifier +hi def link PikchrNumPropty Identifier +hi def link PikchrNthObj Constant +hi def link PikchrOperator Operator + +" define stmt +hi def link PikchrDefine Define +hi def link PikchrCustomObject Type + +" literals +hi def link PikchrComment Comment +hi def link PikchrString String +hi def link PikchrVariable Identifier +hi def link PikchrDollVar Identifier +hi def link PikchrLabel Identifier +hi def link PikchrNumber Number +hi def link PikchrOrdinal Number + +" matches +hi def link PikchrAttribute Tag +hi def link PikchrAttributeSup Tag +hi def link PikchrPosition Function +hi def link PikchrDotEdgename Identifier +hi def link PikchrDotPropty Identifier +hi def link PikchrPathElem Statement