commit 659ea9df05651db6936a174632b436671eca75c4 Author: rhiannon morris Date: Fri Jan 14 21:15:22 2022 +0100 first diff --git a/README.md b/README.md new file mode 100644 index 0000000..519308b --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# vim syntax highlighting for [bqn] + +i know there's one in the repository but i don't like it very much. and +i already made a [global input method][ibus] so i don't want that bit either + +[bqn]: https://mlochbaum.github.io/BQN +[ibus]: https://git.rhiannon.website/rhi/bqn-ibus diff --git a/ftdetect/bqn.vim b/ftdetect/bqn.vim new file mode 100644 index 0000000..8b5e912 --- /dev/null +++ b/ftdetect/bqn.vim @@ -0,0 +1 @@ +au BufRead,BufNewFile *.bqn setfiletype bqn diff --git a/syntax/bqn.vim b/syntax/bqn.vim new file mode 100644 index 0000000..254e39f --- /dev/null +++ b/syntax/bqn.vim @@ -0,0 +1,64 @@ +if exists('b:current_syntax') + finish +endif + +" can't include • and ¯ because their codepoints +" are greater than 255. lol. lmao +syn iskeyword @,48-57,_,192-255,. + +syn region bqnComment start=/#/ end=/$/ +hi def link bqnComment Comment + +syn match bqnError /\[\|\]\|\*\|[↙↖→⍳⍎⍕~]\|\\/ +hi def link bqnError Error + +syn match bqnDelim /[{}()⟨⟩‿,⋄:;?←⇐↩]/ +hi def link bqnDelim Delimiter + +syn match bqnOp "[-¬!√÷+=⋆×⌽∊⍷↑⍋∧⊔⊑⊏⊒⊐⊣⊢|⍉↕«»⋈⥊↓⍒∨⌈⌊≢≡<≤∾>≥≍/≠]" +hi def link bqnOp Function + +syn match bqnNameOp /\%(\<\|\%(•\|\.\)\@<=\)\u\%(\w\|¯\)*\>/ +hi def link bqnNameOp bqnOp + +syn match bqnMod1 /[`˜˘¨⁼⌜´˝˙]/ +hi def link bqnMod1 Typedef + +syn match bqnNameMod1 /\%(\<\|\%(•\|\.\)\@<=\)_\%(\w\|¯\)\+\>/ +hi def link bqnNameMod1 bqnMod1 + +syn match bqnMod2 /[⎉⚇⍟◶⊘⎊⊸∘○⌾⟜]/ +hi def link bqnMod2 Keyword + +syn match bqnNameMod2 /\%(\<\|\%(•\|\.\)\@<=\)_\%(\w\|¯\)\+_\>/ +hi def link bqnNameMod2 bqnMod2 + +" system subjects highlighted different +syn match bqnSubject /\%(\<\|\.\@<=\)\l\%(\w\|¯\)*\>/ +hi def link bqnSubject Normal + +syn match bqnSystem /•\%(\l\%(\w\|¯\)*\%(\>\|\.\@=\)\)\?/ +hi def link bqnSystem Macro + +syn match bqnSpecialName /[𝕨𝕎𝕩𝕏𝕗𝔽𝕘𝔾𝕤𝕊]\|_𝕣_\?/ +hi def link bqnSpecialName Label + + +syn match bqnNothing /·/ +hi def link bqnNothing Constant + +syn region bqnString start=/"/ end=/"/ contains=bqnStrEscape +hi def link bqnString String + +syn match bqnStrEscape /""/ contained +hi def link bqnString Character + +syn match bqnNumber /∞\|π\|¯\?\d\%(\%(\d\|_\)*\d\)\?\%(\.\%(\%(\d\|_\)*\d\)\?\)\?/ +hi def link bqnNumber Number + +" yes including ''' +syn match bqnChar /'.'\|@/ +hi def link bqnChar String + + +let b:current_syntax = 'bqn'