aboutsummaryrefslogtreecommitdiffstats
path: root/.config
diff options
context:
space:
mode:
authorla-ninpre <leobrekalini@gmail.com>2020-12-14 02:06:35 +0300
committerla-ninpre <leobrekalini@gmail.com>2020-12-14 02:06:35 +0300
commit4b8406a1f3e58890e84b93cc8eafef7a016dce1c (patch)
treee2333c0669c3f79ceb6cd3058a893a0788e35d22 /.config
parentaf76d2a34973b0cdc1d9d6aba9c09655e05c00a6 (diff)
downloaddotfiles-4b8406a1f3e58890e84b93cc8eafef7a016dce1c.tar.gz
dotfiles-4b8406a1f3e58890e84b93cc8eafef7a016dce1c.zip
vim: add pikchr syntax highlighting
it's very poor, but kinda works.
Diffstat (limited to '.config')
-rw-r--r--.config/nvim/ftdetect/pikchr.vim1
-rw-r--r--.config/nvim/syntax/pikchr.vim89
2 files changed, 90 insertions, 0 deletions
diff --git a/.config/nvim/ftdetect/pikchr.vim b/.config/nvim/ftdetect/pikchr.vim
new file mode 100644
index 0000000..ebd25b4
--- /dev/null
+++ b/.config/nvim/ftdetect/pikchr.vim
@@ -0,0 +1 @@
+autocmd BufRead,BufNewFile *.pikchr set filetype=pikchr
diff --git a/.config/nvim/syntax/pikchr.vim b/.config/nvim/syntax/pikchr.vim
new file mode 100644
index 0000000..4e1ffae
--- /dev/null
+++ b/.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