From 2312be870bfbd28ecb7afe47d14d98e02833cdb4 Mon Sep 17 00:00:00 2001 From: Sarah Burns Date: Mon, 6 Dec 2021 04:37:26 -0800 Subject: fix for opening multiple BQN buffers in kakoune --- editors/kak/autoload/filetype/bqn.kak | 201 +++++++++++++++++----------------- 1 file changed, 101 insertions(+), 100 deletions(-) diff --git a/editors/kak/autoload/filetype/bqn.kak b/editors/kak/autoload/filetype/bqn.kak index f85f6431..c8c7911a 100644 --- a/editors/kak/autoload/filetype/bqn.kak +++ b/editors/kak/autoload/filetype/bqn.kak @@ -3,6 +3,10 @@ hook global BufCreate .*\.bqn %{ set-option buffer filetype bqn + + set-option buffer matching_pairs ( ) { } [ ] ⟨ ⟩ + + map buffer insert '\' ':enter-user-mode bqn' -docstring 'enter bqn character' } # Initialization @@ -13,103 +17,6 @@ hook global WinSetOption filetype=bqn %¹ hook window InsertChar \n -group bqn-indent bqn-indent-on-new-line hook window InsertChar [}⟩\]] -group bqn-indent bqn-indent-on-closing - set-option buffer matching_pairs ( ) { } [ ] ⟨ ⟩ - - declare-user-mode bqn - map buffer insert '\' ':enter-user-mode bqn' -docstring 'enter bqn character' - - # + + + Conjugate | Add - # - - - Negate | Subtract - map buffer bqn '=' ':exec i×' -docstring '× Sign | Multiply' - map buffer bqn ':exec i÷' -docstring '÷ Recipical | Divide' - map buffer bqn '+' ':exec i⋆' -docstring '⋆ Exponential | Power' - map buffer bqn '_' ':exec i√' -docstring '√ Square root | Root' - map buffer bqn 'b' ':exec i⌊' -docstring '⌊ Floor | Minimum' - map buffer bqn 'B' ':exec i⌈' -docstring '⌈ Ceiling | Maximum' - map buffer bqn 't' ':exec i∧' -docstring '∧ SortUp | And' - map buffer bqn 'v' ':exec i∨' -docstring '∨ SortDown | Or' - map buffer bqn '~' ':exec i¬' -docstring '¬ Not | Span' - # | | | AbsoluteValue | Modulus - map buffer bqn '<' ':exec i≤' -docstring '≤ | LessOrEqual' - # < < < Enclose | LessThan - # > > > Merge | GreaterThan - map buffer bqn '>' ':exec i>' -docstring '> | GreaterOrEqual' - # = = = Rank | Equal - map buffer bqn '/' ':exec i≠' -docstring '≠ Length | NotEqual' - map buffer bqn 'm' ':exec i≡' -docstring '≡ Depth | Match' - map buffer bqn 'M' ':exec i≢' -docstring '≢ Shape | NotMatch' - map buffer bqn '{' ':exec i⊣' -docstring '⊣ Identity | Left' - map buffer bqn '}' ':exec i⊢' -docstring '⊢ Identity | Right' - map buffer bqn 'z' ':exec i⥊' -docstring '⥊ Deshape | Reshape' - map buffer bqn ',' ':exec i∾' -docstring '∾ Join | JoinTo' - map buffer bqn '.' ':exec i≍' -docstring '≍ Solo | Couple' - map buffer bqn 'Z' ':exec i⋈' -docstring '⋈ Enclose | Pair' - map buffer bqn 'r' ':exec i↑' -docstring '↑ Prefixes | Take' - map buffer bqn 'c' ':exec i↓' -docstring '↓ Suffixes | Drop' - map buffer bqn 'd' ':exec i↕' -docstring '↕ Range | Windows' - map buffer bqn 'H' ':exec i«' -docstring '« ShiftBefore | ReplaceEnd' - map buffer bqn 'L' ':exec i»' -docstring '» ShiftAfter | ReplaceStart' - map buffer bqn 'q' ':exec i⌽' -docstring '⌽ Reverse | Rotate' - map buffer bqn 'a' ':exec i⍉' -docstring '⍉ Transpose | ReorderAxis' - map buffer bqn 'T' ':exec i⍋' -docstring '⍋ GradeUp | BinsUp' - map buffer bqn 'V' ':exec i⍒' -docstring '⍒ GradeDown | BinsDown' - map buffer bqn 'i' ':exec i⊏' -docstring '⊏ FirstCell | Select' - map buffer bqn 'I' ':exec i⊑' -docstring '⊑ First | Pick' - map buffer bqn 'o' ':exec i⊐' -docstring '⊐ Classify | IndexOf' - map buffer bqn 'O' ':exec i⊒' -docstring '⊒ VisitCount | AdvanceIndexOf' - map buffer bqn 'e' ':exec i∊' -docstring '∊ MarkFirst | MemberOf' - map buffer bqn 'E' ':exec i⍷' -docstring '⍷ Deduplicate | Find' - map buffer bqn 'u' ':exec i⊔' -docstring '⊔ GroupIndices | Group' - # / / / Indices | Replicate - # ! ! ! Assert | AssertMsg - - map buffer bqn '"' ':exec i˙' -docstring '˙ _constant' - map buffer bqn '`' ':exec i˜' -docstring '˜ _self | _swap' - map buffer bqn '1' ':exec i˘' -docstring '˘ _cells' - map buffer bqn '2' ':exec i¨' -docstring '¨ _each' - map buffer bqn '3' ':exec i⁼' -docstring '⁼ _undo' - map buffer bqn '4' ':exec i⌜' -docstring '⌜ _table' - map buffer bqn '5' ':exec i´' -docstring '´ _fold' - map buffer bqn '6' ':exec i˝' -docstring '˝ _insert' - # ` ` ` _scan - map buffer bqn 'j' ':exec i∘' -docstring '∘ _atop_' - map buffer bqn 'k' ':exec i○' -docstring '○ _over_' - map buffer bqn 'h' ':exec i⊸' -docstring '⊸ _bind_before_' - map buffer bqn 'l' ':exec i⟜' -docstring '⟜ _bind_after_' - map buffer bqn 'K' ':exec i⌾' -docstring '⌾ _under_' - map buffer bqn '%' ':exec i⊘' -docstring '⊘ _valences_' - map buffer bqn '$' ':exec i◶' -docstring '◶ _choose_' - map buffer bqn '^' ':exec i⎊' -docstring '⎊ _catch_' - map buffer bqn '!' ':exec i⎉' -docstring '⎉ _rank_' - map buffer bqn '@' ':exec i⚇' -docstring '⚇ _depth_' - map buffer bqn '#' ':exec i⍟' -docstring '⍟ _repeat_' - map buffer bqn '[' ':exec i←' -docstring '← DEFINE' - map buffer bqn '?' ':exec i⇐' -docstring '⇐ EXPORT' - map buffer bqn "'" ':exec i↩' -docstring '↩ CHANGE' - map buffer bqn ';' ':exec i⋄' -docstring '⋄ SEPERATOR' - map buffer bqn '(' ':exec i⟨' -docstring '⟨ BEGIN LIST' - map buffer bqn ')' ':exec i⟩' -docstring '⟩ END LIST' - map buffer bqn ':exec i‿' -docstring '‿ STRAND' - map buffer bqn ':' ':exec i·' -docstring '· NOTHING' - map buffer bqn '0' ':exec i•' -docstring '• SYSTEM' - - map buffer bqn 'w' ':exec i𝕨' -docstring '𝕨 left argument' - map buffer bqn 'W' ':exec i𝕎' -docstring '𝕎 left argument function' - map buffer bqn 'x' ':exec i𝕩' -docstring '𝕩 right argument' - map buffer bqn 'X' ':exec i𝕏' -docstring '𝕏 right argument function' - map buffer bqn 'f' ':exec i𝕗' -docstring '𝕗 left operand' - map buffer bqn 'F' ':exec i𝔽' -docstring '𝔽 left operand function' - map buffer bqn 'g' ':exec i𝕘' -docstring '𝕘 right operand' - map buffer bqn 'G' ':exec i𝔾' -docstring '𝔾 right operand function' - map buffer bqn 's' ':exec i𝕤' -docstring '𝕤 self' - map buffer bqn 'S' ':exec i𝕊' -docstring '𝕊 self function' - map buffer bqn 'R' ':exec i𝕣' -docstring '𝕣 self modifier' - - map buffer bqn '9' ':exec i¯' -docstring '¯ minus' - map buffer bqn 'p' ':exec iπ' -docstring 'π constant pi' - map buffer bqn '8' ':exec i∞' -docstring '∞ constant infinity' - # @ constant null character - # # COMMENT hook -once -always window WinSetOption filetype=.* %{ remove-hooks window bqn-.+ } ¹ @@ -119,8 +26,7 @@ hook -group bqn-highlight global WinSetOption filetype=bqn %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/bqn } } - -provide-module bqn %~ +provide-module bqn %¹ # Highlighters & Completion # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ @@ -150,6 +56,101 @@ add-highlighter shared/bqn/code/ regex "•?\b_[A-Za-z][A-Z_a-z0-9π∞¯]*|_ add-highlighter shared/bqn/code/ regex "[∘○⊸⟜⌾⊘◶⎉⚇⍟⎊]" 0:yellow add-highlighter shared/bqn/code/ regex "•?\b_[A-Za-z][A-Z_a-z0-9π∞¯]*_|_𝕣_" 0:yellow +declare-user-mode bqn + +# + + + Conjugate | Add +# - - - Negate | Subtract +map global bqn '=' ':exec i×' -docstring '× Sign | Multiply' +map global bqn ':exec i÷' -docstring '÷ Recipical | Divide' +map global bqn '+' ':exec i⋆' -docstring '⋆ Exponential | Power' +map global bqn '_' ':exec i√' -docstring '√ Square root | Root' +map global bqn 'b' ':exec i⌊' -docstring '⌊ Floor | Minimum' +map global bqn 'B' ':exec i⌈' -docstring '⌈ Ceiling | Maximum' +map global bqn 't' ':exec i∧' -docstring '∧ SortUp | And' +map global bqn 'v' ':exec i∨' -docstring '∨ SortDown | Or' +map global bqn '~' ':exec i¬' -docstring '¬ Not | Span' +# | | | AbsoluteValue | Modulus +map global bqn '<' ':exec i≤' -docstring '≤ | LessOrEqual' +# < < < Enclose | LessThan +# > > > Merge | GreaterThan +map global bqn '>' ':exec i>' -docstring '> | GreaterOrEqual' +# = = = Rank | Equal +map global bqn '/' ':exec i≠' -docstring '≠ Length | NotEqual' +map global bqn 'm' ':exec i≡' -docstring '≡ Depth | Match' +map global bqn 'M' ':exec i≢' -docstring '≢ Shape | NotMatch' +map global bqn '{' ':exec i⊣' -docstring '⊣ Identity | Left' +map global bqn '}' ':exec i⊢' -docstring '⊢ Identity | Right' +map global bqn 'z' ':exec i⥊' -docstring '⥊ Deshape | Reshape' +map global bqn ',' ':exec i∾' -docstring '∾ Join | JoinTo' +map global bqn '.' ':exec i≍' -docstring '≍ Solo | Couple' +map global bqn 'Z' ':exec i⋈' -docstring '⋈ Enclose | Pair' +map global bqn 'r' ':exec i↑' -docstring '↑ Prefixes | Take' +map global bqn 'c' ':exec i↓' -docstring '↓ Suffixes | Drop' +map global bqn 'd' ':exec i↕' -docstring '↕ Range | Windows' +map global bqn 'H' ':exec i«' -docstring '« ShiftBefore | ReplaceEnd' +map global bqn 'L' ':exec i»' -docstring '» ShiftAfter | ReplaceStart' +map global bqn 'q' ':exec i⌽' -docstring '⌽ Reverse | Rotate' +map global bqn 'a' ':exec i⍉' -docstring '⍉ Transpose | ReorderAxis' +map global bqn 'T' ':exec i⍋' -docstring '⍋ GradeUp | BinsUp' +map global bqn 'V' ':exec i⍒' -docstring '⍒ GradeDown | BinsDown' +map global bqn 'i' ':exec i⊏' -docstring '⊏ FirstCell | Select' +map global bqn 'I' ':exec i⊑' -docstring '⊑ First | Pick' +map global bqn 'o' ':exec i⊐' -docstring '⊐ Classify | IndexOf' +map global bqn 'O' ':exec i⊒' -docstring '⊒ VisitCount | AdvanceIndexOf' +map global bqn 'e' ':exec i∊' -docstring '∊ MarkFirst | MemberOf' +map global bqn 'E' ':exec i⍷' -docstring '⍷ Deduplicate | Find' +map global bqn 'u' ':exec i⊔' -docstring '⊔ GroupIndices | Group' +# / / / Indices | Replicate +# ! ! ! Assert | AssertMsg + +map global bqn '"' ':exec i˙' -docstring '˙ _constant' +map global bqn '`' ':exec i˜' -docstring '˜ _self | _swap' +map global bqn '1' ':exec i˘' -docstring '˘ _cells' +map global bqn '2' ':exec i¨' -docstring '¨ _each' +map global bqn '3' ':exec i⁼' -docstring '⁼ _undo' +map global bqn '4' ':exec i⌜' -docstring '⌜ _table' +map global bqn '5' ':exec i´' -docstring '´ _fold' +map global bqn '6' ':exec i˝' -docstring '˝ _insert' +# ` ` ` _scan +map global bqn 'j' ':exec i∘' -docstring '∘ _atop_' +map global bqn 'k' ':exec i○' -docstring '○ _over_' +map global bqn 'h' ':exec i⊸' -docstring '⊸ _bind_before_' +map global bqn 'l' ':exec i⟜' -docstring '⟜ _bind_after_' +map global bqn 'K' ':exec i⌾' -docstring '⌾ _under_' +map global bqn '%' ':exec i⊘' -docstring '⊘ _valences_' +map global bqn '$' ':exec i◶' -docstring '◶ _choose_' +map global bqn '^' ':exec i⎊' -docstring '⎊ _catch_' +map global bqn '!' ':exec i⎉' -docstring '⎉ _rank_' +map global bqn '@' ':exec i⚇' -docstring '⚇ _depth_' +map global bqn '#' ':exec i⍟' -docstring '⍟ _repeat_' +map global bqn '[' ':exec i←' -docstring '← DEFINE' +map global bqn '?' ':exec i⇐' -docstring '⇐ EXPORT' +map global bqn "'" ':exec i↩' -docstring '↩ CHANGE' +map global bqn ';' ':exec i⋄' -docstring '⋄ SEPERATOR' +map global bqn '(' ':exec i⟨' -docstring '⟨ BEGIN LIST' +map global bqn ')' ':exec i⟩' -docstring '⟩ END LIST' +map global bqn ':exec i‿' -docstring '‿ STRAND' +map global bqn ':' ':exec i·' -docstring '· NOTHING' +map global bqn '0' ':exec i•' -docstring '• SYSTEM' + +map global bqn 'w' ':exec i𝕨' -docstring '𝕨 left argument' +map global bqn 'W' ':exec i𝕎' -docstring '𝕎 left argument function' +map global bqn 'x' ':exec i𝕩' -docstring '𝕩 right argument' +map global bqn 'X' ':exec i𝕏' -docstring '𝕏 right argument function' +map global bqn 'f' ':exec i𝕗' -docstring '𝕗 left operand' +map global bqn 'F' ':exec i𝔽' -docstring '𝔽 left operand function' +map global bqn 'g' ':exec i𝕘' -docstring '𝕘 right operand' +map global bqn 'G' ':exec i𝔾' -docstring '𝔾 right operand function' +map global bqn 's' ':exec i𝕤' -docstring '𝕤 self' +map global bqn 'S' ':exec i𝕊' -docstring '𝕊 self function' +map global bqn 'R' ':exec i𝕣' -docstring '𝕣 self modifier' + +map global bqn '9' ':exec i¯' -docstring '¯ minus' +map global bqn 'p' ':exec iπ' -docstring 'π constant pi' +map global bqn '8' ':exec i∞' -docstring '∞ constant infinity' +# @ @ @ constant null character +# # # # COMMENT + # Commands # ‾‾‾‾‾‾‾‾ @@ -173,4 +174,4 @@ define-command -hidden bqn-indent-on-closing %` _ ` -~ +¹ -- cgit v1.2.3