aboutsummaryrefslogtreecommitdiff
path: root/editors/vim
diff options
context:
space:
mode:
Diffstat (limited to 'editors/vim')
-rw-r--r--editors/vim/ftdetect/bqn.vim2
-rw-r--r--editors/vim/ftplugin/bqn.vim8
-rw-r--r--editors/vim/keymap/bqn.vim22
-rw-r--r--editors/vim/syntax/bqn.vim50
4 files changed, 82 insertions, 0 deletions
diff --git a/editors/vim/ftdetect/bqn.vim b/editors/vim/ftdetect/bqn.vim
new file mode 100644
index 00000000..97f7d548
--- /dev/null
+++ b/editors/vim/ftdetect/bqn.vim
@@ -0,0 +1,2 @@
+au BufRead,BufNewFile *.bqn setf bqn
+au BufRead,BufNewFile * if getline(1) =~ '^#!.*bqn$' | setf bqn | endif
diff --git a/editors/vim/ftplugin/bqn.vim b/editors/vim/ftplugin/bqn.vim
new file mode 100644
index 00000000..41eb3912
--- /dev/null
+++ b/editors/vim/ftplugin/bqn.vim
@@ -0,0 +1,8 @@
+setlocal keymap=bqn
+
+setlocal commentstring=#%s
+setlocal matchpairs=(:),{:},[:],⟨:⟩
+setlocal iskeyword=@,48-57,_,^×,^÷
+setlocal ignorecase
+
+setlocal shiftwidth=2 tabstop=2 softtabstop=2
diff --git a/editors/vim/keymap/bqn.vim b/editors/vim/keymap/bqn.vim
new file mode 100644
index 00000000..beaa19ee
--- /dev/null
+++ b/editors/vim/keymap/bqn.vim
@@ -0,0 +1,22 @@
+scripte utf-8
+let b:keymap_name=expand('<sfile>:t:r')
+
+" Configurable prefix key; backslash by default
+let p=exists('g:bqn_prefix_key')?g:bqn_prefix_key:'\'
+
+let a ='`1234567890-= ~!@#$%^&*()_+'
+let a.='qwertyuiop[] QWERTYUIOP{} '
+let a.='asdfghjkl;''\ ASDFGHJKL:"| '
+let a.='zxcvbnm,./ ZXCVBNM<>? '
+
+let b ='˜˘¨⁼⌜´˝7∞¯•÷× ¬⎉⚇⍟◶⊘⎊⍎⍕⟨⟩√⋆'
+let b.='⌽𝕨∊↑∧y⊔⊏⊐π←→ ↙𝕎⍷𝕣⍋YU⊑⊒⍳⊣⊢ '
+let b.='⍉𝕤↕𝕗𝕘⊸∘○⟜⋄↩\ ↖𝕊D𝔽𝔾HJ⌾L·˙| '
+let b.='⥊𝕩↓∨⌊n≡∾≍≠ Z𝕏C⍒⌈N≢≤≥? '
+
+let[A,B]=map([a,b],"split(v:val,'\\zs *')")
+for i in range(len(A))|exe escape('lno<buffer>'.p.A[i].' '.B[i],'|')|endfor
+for i in range(len(A))|exe escape('cno<buffer>'.p.A[i].' '.B[i],'|')|endfor
+lno<buffer>\<space> ‿
+cno<buffer>\<space> ‿
+unl a b A B i p
diff --git a/editors/vim/syntax/bqn.vim b/editors/vim/syntax/bqn.vim
new file mode 100644
index 00000000..cbd71386
--- /dev/null
+++ b/editors/vim/syntax/bqn.vim
@@ -0,0 +1,50 @@
+if exists('b:current_syntax')
+ finish
+endif
+
+syn match bqnerr "[^ \r\n]"
+syn match bqnblk "[{}]"
+syn match bqnlst "[⟨⟩\[\]‿]"
+syn match bqnpar "[()]"
+syn match bqnhed "[:;]"
+syn match bqnsep "[⋄,]"
+syn match bqnarw "[←↩→]"
+syn match bqnchr "'.'"
+syn match bqn1md "[˜˘¨⌜⁼´˝`]"
+syn match bqn2md "[∘○⊸⟜⌾⊘◶⎉⚇⍟⎊]"
+syn match bqnfun "[𝔽𝔾𝕎𝕏𝕊+\-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍↑↓↕⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!⍕⍎]"
+syn match bqnsub "[𝕗𝕘𝕨𝕩𝕤]"
+syn match bqnnot "·"
+syn match bqnnum "\v\c¯?((\d+\.)?\d+(e¯?\d+)?|π|∞)(i¯?((\d+\.)?\d+(e¯?\d+)?|π|∞))?"
+syn match bqnsid "\(•\|•\?[a-z][A-Z_a-z0-9]*\|𝕣\)"
+syn match bqnfid "•\?[A-Z][A-Z_a-z0-9]*"
+syn match bqn1id "\(•\?_[A-Za-z][A-Z_a-z0-9]*\|_𝕣\)"
+syn match bqn2id "\(•\?_[A-Za-z][A-Z_a-z0-9]*_\|_𝕣_\)"
+syn match bqncom "#.*$"
+syn match bqnquo /""/ contained
+syn region bqnstr matchgroup=bqnstr start=/"/ end=/"/ contains=bqnquo
+syn sync fromstart
+
+hi link bqnerr error
+hi link bqncom comment
+hi link bqnblk special
+hi link bqnhed delimiter
+hi link bqnpar delimiter
+hi link bqnlst preproc
+hi link bqnsep preproc
+hi link bqnarw normal
+hi link bqnchr string
+hi link bqnstr string
+hi link bqnquo specialchar
+hi link bqnnum number
+hi link bqnnot constant
+hi link bqnsub normal
+hi link bqnsid normal
+hi link bqnfun type
+hi link bqnfid type
+hi link bqn1md macro
+hi link bqn1id macro
+hi link bqn2md operator
+hi link bqn2id operator
+
+let b:current_syntax='bqn'