1
Fork 0

Add miros support!

This commit is contained in:
prescientmoon 2024-04-16 23:25:20 +02:00
parent 5652b531ba
commit 1ed3a529c9
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4
26 changed files with 910 additions and 1153 deletions

View file

@ -1,3 +0,0 @@
# Vscode snippets
These are snippets usable both in vscode and neovim, defined in vscode format.

View file

@ -0,0 +1,28 @@
block start
string msetup
name setup module
desc Create a lua module together with a .setup() function
snip
local M = {}
function M.setup()
$0
end
return M
string describe
name busted describe
desc Create a describe grouping for busted tests
snip
describe("$1", function ()
$0
end)
string it
name busted it
desc Create a busted test
snip
it("$1", function ()
$0
end)

View file

@ -0,0 +1,31 @@
block auto start
string for
snip
for $1 <- $|2⟨\@\⟨$2\⟩,$2⟩
$0
for kind <- @⟨string,pattern⟩
string @⟨@kind:s,p⟩snip
snip
@kind $1
name $2
snip $3
$0
block auto !word
string choice
name choice node
snip \$|$1⟨$2\⟩$0
string nonempty
name nonempty node
snip \$?$1⟨$2\⟩$0
string arrin
name array index
snip \@\⟨\@$1:$2\⟩
string nil
name ignore symbol
snip \⋄

View file

@ -0,0 +1,11 @@
block auto
string fetchgh
name fetch github
desc Fetch a GitHub repository
snip
pkgs.fetchFromGitHub {
owner = $1;
repo = $2;
rev = "";
sha256 = "";
}$0

View file

@ -1,55 +0,0 @@
{
"name": "lunar-snippets",
"engines": {
"vscode": "^1.11.0"
},
"contributes": {
"snippets": [
{
"language": [
"purs",
"purescript"
],
"path": "./snippets/purescript/other.json"
},
{
"language": [
"purs",
"purescript"
],
"path": "./snippets/purescript/imports.json"
},
{
"language": [
"purs",
"purescript"
],
"path": "./snippets/purescript/deriving.json"
},
{
"language": [
"tex"
],
"path": "./snippets/latex/core.json"
},
{
"language": [
"tex"
],
"path": "./snippets/latex/explain.json"
},
{
"language": [
"lua"
],
"path": "./snippets/lua/core.json"
},
{
"language": [
"nix"
],
"path": "./snippets/nix/core.json"
}
]
}
}

View file

@ -0,0 +1,108 @@
block start auto
string val
name value definition
desc Create a value-level declaration
snip
$1 :: $2
$1 $3 = $4
for kind <- @⟨type,newtype,data⟩
string @kind
name @kind definition
desc Define a @⟨@kind:type,newtype,adt⟩
snip data $1 = $2
string example
name example docstring
desc Provide example usage for some piece of code
snip
-- | Example:
-- | ```purs
-- | $0
-- | ```
string class
name typeclass declaration
desc Declare a typeclass
snip
class $1 $|2⟨
where
$2,
$2
string instance
name typeclass instance
desc Declare a typeclass instance
snip
instance $1 $|2⟨
where
$2,
$2
string derive
name derive typeclass instance
desc Derive a typeclass instance
snip
derive $|1⟨$1,newtype $1⟩instance $0
for typeclass <- @⟨Eq,Ord,Functor⟩
string d@⟨@typeclass:eq,ord,functor⟩
name derive @typeclass
snip derive @typeclass $0
for typeclass <- @⟨Newtype,Generic⟩
string d@⟨@typeclass:newtype,generic⟩
name derive @typeclass
snip derive @typeclass $1 _
for typeclass <- @⟨Show,Debug⟩
for lower <- @⟨@typeclass:show,debug⟩
string g@lower
name generic @lower instance
snip
instance @typeclass $1 where
@lower = generic@typeclass
string djson
name derive json instances
snip
derive newtype instance EncodeJson $",
derive newtype instance DecodeJson $1
string gjson
name generic json instances
snip
instance EncodeJson $1 where
encodeJson = genericEncodeJson
instance DecodeJson $1 where
decodeJson = genericDecodeJson
block auto
string ite
name if-then-else
snip if $1 then $2 else $0
string caseof
name pattern match
snip
case $1 of
$2 -> $0
block start
for module <- @⟨
Map,
HashMap,
Set,
HashSet,
Array,
List,
String,
Int,
Number
string imp@⟨@module:map,hashmap,set,hashset,array,list,string,int,number⟩
name import Data.@module
snip import Data.@module as @module

View file

@ -1,193 +0,0 @@
{
"Set": {
"prefix": "set",
"description": "Set I guess",
"body": "\\{$1\\\\}$0"
},
"Absolute value": {
"prefix": "abs",
"description": "Absolute values",
"body": "\\abs{$1}$0"
},
"Norm": {
"prefix": "norm",
"description": "Norm of a vector",
"body": "\\norm{$1}$0"
},
"Probability function": {
"prefix": "prob",
"description": "Probability function applied to some set",
"body": "\\prob{$1}$0"
},
"Inner product": {
"prefix": "iprod",
"description": "Inner product of two vectors",
"body": "\\iprod{$1}{$2}$0"
},
"Self inner product": {
"prefix": "diprod",
"description": "Inner product of a vector with itself",
"body": "\\dprod{$1}$0"
},
"Subscript": {
"prefix": "ss",
"description": "Subscript",
"body": "_{$1}$0"
},
"Exponent": {
"prefix": "ee",
"description": "Exponent",
"body": "^{$1}$0"
},
"Nth derivative": {
"prefix": "dd",
"description": "Nth derivative",
"body": "^{($1)}$0"
},
"Overline": {
"prefix": "ol",
"description": "Overline",
"body": "\\overline{$1}$0"
},
"Z Mod": {
"prefix": "zmod",
"description": "The set of Z/nZ",
"body": "\\mathbb{Z}/$1\\mathbb{Z}$0"
},
"Sigma sum": {
"prefix": "bsum",
"description": "Create a sum using sigma notation",
"body": "\\sum_{$1 = $2}^{$3}$0"
},
"Pi product": {
"prefix": "bproduct",
"description": "Create a produt using pi notation",
"body": "\\prod_{$1 = $2}^{$3}$0"
},
"Fraction": {
"prefix": "frac",
"description": "Create a fraction",
"body": "\\frac{$1}{$2}$0"
},
"Choose": {
"prefix": "binom",
"description": "Create a (n choose k) thingy",
"body": "\\binom{$1}{$2}$0"
},
"Limit": {
"prefix": "lim",
"description": "Create a limit",
"body": "\\lim _{$1 \\to $2}$0"
},
"Limit to infinity": {
"prefix": "ilim",
"description": "Create a limit as a variable goes to infinity",
"body": "\\lim _{$1 \\to \\infty}$0"
},
"Limit to negative infinity": {
"prefix": "nlim",
"description": "Create a limit as a variable goes to negative infinity",
"body": "\\lim _{$1 \\to -\\infty}$0"
},
"Limit to zero": {
"prefix": "zlim",
"description": "Create a limit as a variable goes to 0",
"body": "\\lim _{$1 \\to 0}$0"
},
"Sqrt": {
"prefix": "sqrt",
"description": "Create a sqrt",
"body": "\\sqrt[$1]{$2}$0"
},
"Sin": {
"prefix": "sin",
"description": "Create a sin call",
"body": "\\sin($1)$0"
},
"Cos": {
"prefix": "cos",
"description": "Create a cos call",
"body": "\\cos($1)$0"
},
"Ln": {
"prefix": "ln",
"description": "Create a ln call",
"body": "\\ln($1)$0"
},
"Let": {
"prefix": "let",
"description": "Let something equal something else",
"body": "Let $$1 = $2$. $0"
},
"System of equations": {
"prefix": "eqsystem",
"description": "Create a system of equations",
"body": [
"\\left\\{",
"\t\\begin{array}{rl}",
"\t\t$0",
"\t\\end{array}",
"\\right\\\\\\}"
]
},
"Aligned equation": {
"prefix": "aleq",
"description": "Aligned equation",
"body": [
"\\\\\\ $1 &= $2",
"$0"
]
},
"2x2 matrices": {
"prefix": "mat22",
"description": "Create a 2x2 matrix",
"body": [
"\\begin{bmatrix}",
" ${1:1} & ${2:0}",
"\\\\\\ ${3:0} & ${4:1}",
"\\end{bmatrix}$0"
]
},
"3x3 matrices": {
"prefix": "mat33",
"description": "Create a 3x3 matrix",
"body": [
"\\begin{bmatrix}",
" ${1:1} & ${2:0} & ${3:0}",
"\\\\\\ ${4:0} & ${5:1} & ${6:0}",
"\\\\\\ ${7:0} & ${8:0} & ${9:1}",
"\\end{bmatrix}$0"
]
},
"3x3 determinants": {
"prefix": "det33",
"description": "Create a 3x3 determinant",
"body": [
"\\begin{vmatrix}",
" $1 & $2 & $3",
"\\\\\\ $4 & $5 & $6",
"\\\\\\ $7 & $8 & $9",
"\\end{vmatrix}$0"
]
},
"2x2 determinants": {
"prefix": "det22",
"description": "Create a 2x2 determinant",
"body": [
"\\begin{vmatrix}",
" $1 & $2",
"\\\\\\ $3 & $4",
"\\end{vmatrix}$0"
]
},
"Definite integral": {
"prefix": "dintegral",
"description": "Definite integral",
"body": "\\int_{$1}^{$2} $3 d${4:x}$0"
},
"Indefinite integral": {
"prefix": "integral",
"description": "Integral",
"body": "\\int $1 d${2:x}$0"
}
}

View file

@ -1,87 +0,0 @@
{
"Text explanation in math mode": {
"prefix": "texpl",
"description": "Explain a step using text in math mode",
"body": "&& \\text{($1)}$0"
},
"Explanation in math mode": {
"prefix": "expl",
"description": "Explain a step in math mode",
"body": "&& ($1) $0"
},
"Explain division": {
"prefix": "exdiv",
"description": "Explain a division inside an equation",
"body": "&& \\left(\\frac{\\square}{$1}\\right)$0"
},
"Explain fraction": {
"prefix": "exfract",
"description": "Explain a step which wraps both sides of an equation by a fraction",
"body": "&& \\left(\\frac{$1}{$2} \\right)$0"
},
"Explain right multiplication": {
"prefix": "exmul",
"description": "Explain a right multiplication inside an equation",
"body": "&& \\left(\\square \\cdot $1 \\right)$0"
},
"Explain left multiplication": {
"prefix": "exlmul",
"description": "Explain a left multiplication inside an equation",
"body": "&& \\left($1 \\cdot \\square\\right)$0"
},
"Explain differentiation": {
"prefix": "exdiff",
"description": "Explain a step which differentiates both sides of an equation",
"body": "&& \\left( \\frac{d \\square} {d $1} \\right)$0"
},
"Explain integration": {
"prefix": "exint",
"description": "Explain a step which integrates both sides of an equation",
"body": "&& \\left(\\int \\square d$1 \\right)$0"
},
"Explain definite integration": {
"prefix": "exdint",
"description": "Explain a step which applies a definite integral to both sides of an equation",
"body": "&& \\left(\\int _{$1} ^{$2} \\square d$3 \\right)$0"
},
"Explain addition": {
"prefix": "exadd",
"description": "Explain a step which adds to both sides of an equation",
"body": "&& \\left( \\square + $1 \\right)$0"
},
"Explain subtraction": {
"prefix": "exsub",
"description": "Explain a step which subtracts from both sides of an equation",
"body": "&& \\left( \\square - $1 \\right)$0"
},
"Explain negation": {
"prefix": "exneg",
"description": "Explain a step which negates both sides of an equation",
"body": "&& (- \\square )$0"
},
"Explain power": {
"prefix": "expow",
"description": "Explain a step which raises both sides of an equation to a given power",
"body": "&& \\left( \\square ^{$1} \\right)$0"
},
"Explain exponentiation": {
"prefix": "exexp",
"description": "Explain a step which raises a given value to both sides of an equation",
"body": "&& \\left( $1 ^{\\square} \\right)$0"
},
"Explain natural logarithm": {
"prefix": "exln",
"description": "Explain a step which applies the ln function to both sides of an equation",
"body": "&& \\left( \\ln $1 \\right)$0"
},
"Explain triangle inequality": {
"prefix": "extrin",
"description": "Explain a step using the triangle inequality in math mode",
"body": "&& \\text{(Triangle inequality on $ $1 $)}$0"
},
"Explain being bounded": {
"prefix": "exbound",
"description": "Explain that something is bounded in math mode",
"body": "&& \\text{($ $1 $ is bounded)}$0"
}
}

View file

@ -1,33 +0,0 @@
{
"Lua setup-module": {
"prefix": "msetup",
"description": "Create lua module with setup function inside",
"body": [
"local M = {}",
"",
"function M.setup()",
" $0",
"end",
"",
"return M"
]
},
"Busted describe": {
"prefix": "describe",
"description": "Create a describe call for a busted test",
"body": [
"describe(\"$1\", function ()",
"\t$0",
"end)"
]
},
"Busted it": {
"prefix": "it",
"description": "Create an it call for a busted test",
"body": [
"it(\"$1\", function ()",
"\t$0",
"end)"
]
}
}

View file

@ -1,14 +0,0 @@
{
"Fetch from GitHub": {
"prefix": "fetchFromGitHub",
"description": "Fetch a repo from github",
"body": [
"pkgs.fetchFromGitHub {",
"\towner = \"$1\";",
"\trepo = \"$2\";",
"\trev = \"\";",
"\tsha256 = \"\";",
"}$0"
]
}
}

View file

@ -1,77 +0,0 @@
{
"Derive newtype instance": {
"prefix": "gnderive",
"description": "Use newtype deriving on any typeclass",
"body": "derive newtype instance $0 $3 $2"
},
"Generate json instances": {
"prefix": "json",
"description": "Generate the deriving of the EncodeJson and DecodeJson typeclasses",
"body": [
"derive newtype instance EncodeJson $1",
"derive newtype instance DecodeJson $1"
]
},
"Generic": {
"prefix": "dgeneric",
"description": "Generate the generic instance for a type",
"body": "derive instance Generic $1 _"
},
"Generic Show": {
"prefix": "gshow",
"description": "Generate generic show instances",
"body": [
"instance Show $1 where",
" show = genericShow"
]
},
"Generic Debug": {
"prefix": "gdebug",
"description": "Generate generic debug instances",
"body": [
"instance Debug $1 where",
" debug = genericDebug"
]
},
"Generic json": {
"prefix": "gjson",
"description": "Generate generic json instances",
"body": [
"instance EncodeJson $1 where",
" encodeJson = genericEncodeJson",
"instance DecodeJson $1 where",
" decodeJson = genericDecodeJson"
]
},
"Instance": {
"prefix": "instance",
"description": "Declare typeclass instance",
"body": [
"instance $2 $3 where",
" $0"
]
},
"Functor": {
"prefix": "dfunctor",
"description": "Derive a Functor instance",
"body": "derive instance Functor $1$0"
},
"Eq": {
"prefix": "deq",
"description": "Derive an Eq instance",
"body": "derive instance Eq $1$0"
},
"Ord": {
"prefix": "dord",
"description": "Derive an Ord instance",
"body": "derive instance Ord $1$0"
},
"Eq & Ord": {
"prefix": "deqord",
"description": "Derive an Eq and an Ord instance",
"body": [
"derive instance Eq $1",
"derive instance Ord $1$0"
]
}
}

View file

@ -1,62 +0,0 @@
{
"Tuple constructors": {
"prefix": "imptuple",
"description": "Import tuple constructors",
"body": "import Data.Tuple.Nested (type (/\\), (/\\))"
},
"Map": {
"prefix": "impmap",
"description": "Import Map module",
"body": "import Data.Map as Map"
},
"HashMap": {
"prefix": "imphashmap",
"description": "Import HashMap module",
"body": "import Data.HashMap as HashMap"
},
"FRP Event": {
"prefix": "impevent",
"description": "Import FRP.Event module",
"body": "import FRP.Event as E"
},
"List": {
"prefix": "implist",
"description": "Import List module",
"body": "import Data.List as List"
},
"Array": {
"prefix": "imparray",
"description": "import Array module",
"body": "import Data.Array as Array"
},
"AVar": {
"prefix": "impavar",
"description": "import AVar module",
"body": "import Effect.Aff.AVar as AV"
},
"Object": {
"prefix": "impobject",
"description": "import Foreign.Object module",
"body": "import Foreign.Object as Object"
},
"STObject": {
"prefix": "impstobject",
"description": "import STObject module",
"body": "import Foreign.Object.ST as STObject"
},
"Ref": {
"prefix": "impref",
"description": "import Effect.Ref module",
"body": "import Effect.Ref as Ref"
},
"Int": {
"prefix": "impint",
"description": "import Data.Int module",
"body": "import Data.Int as Int"
},
"Number": {
"prefix": "impnumber",
"description": "import Data.Number module",
"body": "import Data.Number as Number"
}
}

View file

@ -1,61 +0,0 @@
{
"Definition": {
"prefix": "definition",
"description": "Basic purescript definition",
"body": ["$1 :: $2", "$1 = $3"]
},
"SProxy": {
"prefix": "sproxy",
"description": "Generate a proxy constant",
"body": ["_$1 :: Proxy \"$1\"", "_$1 = Proxy"]
},
"Proxy": {
"prefix": "proxy",
"description": "Generate a proxy constant",
"body": ["_$1 :: Proxy $1", "_$1 = Proxy"]
},
"Prop": {
"prefix": "prop",
"description": "Prop lens",
"body": ["_$1 :: Lens' $2 $3", "_$1 = prop (Proxy :: _ \"$1\")"]
},
"Variant constructor": {
"prefix": "inj",
"description": "Generate a constructor for a variant an inline sproxy",
"body": [
"$1 :: forall r a. a -> Variant ( $1 :: a | r)",
"$1 = inj (SProxy :: SProxy \"$1\")"
]
},
"Full variant constructor": {
"prefix": "injf",
"description": "Generate a constructor for a variant with an external sproxy definition",
"body": [
"$1 :: forall r a. a -> Variant ( $1 :: a | r)",
"$1 = inj _$1",
"",
"_$1 :: Proxy \"$1\"",
"_$1 = Proxy"
]
},
"Example code": {
"prefix": "ex",
"description": "Provide example usage for some piece of code",
"body": ["-- |", "-- | Ex:", "-- | ```purs", "-- | $0", "-- | ```"]
},
"Section": {
"prefix": "section",
"description": "Delimit a section using 10 dashes",
"body": "---------- $0"
},
"Typeclass instances": {
"prefix": "sinstances",
"description": "Delimit a section which declares typeclass instances",
"body": ["---------- Typeclass instances", "$0"]
},
"If": {
"prefix": "if",
"description": "If then else expression",
"body": ["if $1", "\tthen $2", "\telse $3"]
}
}

View file

@ -0,0 +1,203 @@
for thmenv <- @⟨theorem,lemma,exercise,definition,corollary,example⟩
for thmprefix <- @⟨@thmenv:thm,lem,exe,def,cor,exa⟩
block auto !math start
for env <- @⟨$1,enumerate,itemize,align*⟩
string @⟨@env:begin,olist,ulist,dm⟩
name @⟨@env:environment,ordered list,unordered list,display math⟩
snip
\begin{@env}
$0
\end{@env}
string proof
snip
\begin{proof}$?1⟨[Proof of @^⟨$1⟩]⟩
$0
\end{proof}
string ciff
name cases for ⟺
snip
\begin{enumerate}
\item[$\implies$]$1,
\item[$\impliedby$]$2,
\end{enumerate}
$0
string item
snip \item$|1⟨,[$1] $0⟩
block text
string ref
snip \ref{$1}$0
string r@thmprefix
snip \ref{@thmprefix:$1}$0
string pref
snip (\ref{$1})$0
string pr@thmprefix
snip (\ref{@thmprefix:$1})$0
string quote
snip ``$1''$0
string forcecr
snip {\ \\\\}
pattern ([Ll]et)
name definition
snip @1 \$$1 = $2\$
block auto
string im
name inline math
snip \$$1\$$0
block math
for shorthand <- @⟨sum,prod⟩
for symbol <- @⟨@shorthand:sigma,pi⟩
for operation <- @⟨@shorthand:sum,product⟩
string b@shorthand
name @symbol @operation
desc Write out a @operation using big @symbol notation
snip \\@symbol{$|1⟨$1 = $2,$1⟩}^$|2⟨{$2},\infty$2⟩ $0
for matkind <- @⟨matrix,determinant⟩
for matenv <- @⟨@matkind:bmatrix,vmatrix⟩
for shorthand <- @⟨@matkind:mat,det⟩
string 2@shorthand
name 2x2 @matkind
snip
\begin{@matenv}
$1 & $2 \\\\
$3 & $4
\end{@matenv}
string 3@shorthand
name 3x3 @matkind
snip
\begin{@matenv}
$1 & $2 & $3 \\\\
$4 & $5 & $6 \\\\
$7 & $8 & $9
\end{@matenv}
for operator <- @⟨eq,neq,leq,geq,lt,gt⟩
for symbol <- @⟨@operator:=,\neq,\leq,\geq,<,>⟩
block auto
string a@operator
name align at @operator
snip &@symbol $0
block auto start
string al@operator
name aligned @operator
snip
\\\\ $1 &@symbol $2
$0
string cr@operator
name start with @operator
snip \\\\&@symbol $0
block start
string eqsystem
name system of equations
snip
\left\{
\begin{array}{rl}
$0
\end{array}
\right\}
block end
for suffix <- @⟨add,sub,rmul,pow,inv⟩
string ex@suffix
snip
&& \lrb{\square @⟨@suffix:
+ $1,
- $1,
\cdot $1,
^{$1},
^{-1},
⟩}$0
for prefix <- @⟨neg,mul,ln⟩
string ex@prefix
snip && \lrb{@⟨@prefix:-,$1,\ln⟩ \square}$0
string exdiv
snip && \lrb{\frac \square {$1}}$0
string exint
snip && \lrb{\int\square \dif $1}$0
string exdint
snip && \lrb{\int_{$1}^{$2}\square \dif $3}$0
for kind <- @⟨texpl,extrin,exbound,exdef⟩
string @kind
snip
&& \lrb{\text{@⟨@kind:
$1,
triangle inequality on $$1$,
$$1$ is bounded,
definition of $$1$,
⟩}}$0
block auto
for constant <- @⟨star,delta,Delta,pi,tau,psi,phi,rho,sigma,alpha,beta,theta,gamma,omega,Omega⟩
string @constant
snip \\@constant
for shortconstant <- @⟨eps,lam⟩
string @shortconstant
snip \\@⟨@shortconstant:epsilon,lambda⟩
for operator <- @⟨overline,hat,abs,norm,prob,diprod,sin,cos,sqrt,ln,lrb,zmod⟩
string @operator
snip \\@operator$|1⟨{$1}, $0⟩
for bioperator <- @⟨iprod,frac,binom⟩
string @bioperator
snip \\@bioperator$|1⟨ $1,{$1}⟩$|2⟨ $2,{$2}⟩ $0
string set
desc Create a set by escaping the brackets
snip \{$1\}
pattern e([%a%d])
name auto exponent
snip ^@0
pattern s([%a%d])
name auto subscript
snip _@0
pattern (\?[%a]+)(%d)
name auto digt subscript
snip @0_@1
string ss
name subscript
snip _{$1}$0
string ee
name exponent
snip ^{$1}$0
for limtarget <- @⟨anything,zero,infinity,negative infinity⟩
for prefix <- @⟨@limtarget:,z,i,n⟩
for limtargetsymbol <- @⟨@limtarget:$2,0,\infty,-\infty⟩
string @prefix⋄lim
name limit to @limtarget
snip \lim_{$1 \to @limtargetsymbol} $0
string dint
name definite integral
snip \int_{$|1⟨$1,-\infty$1⟩}^$|2⟨{$2},\infty$2⟩ $3 \dif $0
string iint
name indefinite integral
snip \int $1 \dif $0