Ændrede diverse ting, især tilføjede jeg en masse lua-snippets
This commit is contained in:
parent
3e9363b016
commit
b1b7a050da
14 changed files with 428 additions and 19 deletions
91
luasnippets/tex/environments.lua
Normal file
91
luasnippets/tex/environments.lua
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
-- Abbreviations used in this article and the LuaSnip docs
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
-- local sn = ls.snippet_node
|
||||
-- local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
-- local f = ls.function_node
|
||||
-- local d = ls.dynamic_node
|
||||
-- local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
--
|
||||
-- AutoSnippet function "as":
|
||||
local function as(trigger, nodes, opts)
|
||||
opts = opts or {}
|
||||
-- Add snippetType = "autosnippet" to the first parameter
|
||||
if type(trigger) == "table" then
|
||||
trigger.snippetType = "autosnippet"
|
||||
else
|
||||
trigger = { trig = trigger, snippetType = "autosnippet" }
|
||||
end
|
||||
return s(trigger, nodes, opts)
|
||||
end
|
||||
|
||||
return {
|
||||
as(
|
||||
"eq",
|
||||
fmta(
|
||||
[[
|
||||
\[
|
||||
<>
|
||||
\]
|
||||
]],
|
||||
{ i(1) }
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
|
||||
as(
|
||||
"\\[",
|
||||
fmta(
|
||||
[[
|
||||
\[
|
||||
<>
|
||||
\]
|
||||
]],
|
||||
{ i(1) }
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
|
||||
as(
|
||||
"beg",
|
||||
fmta(
|
||||
[[
|
||||
\begin{<>}
|
||||
<>
|
||||
\end{<>}
|
||||
]],
|
||||
{ i(1), i(2), rep(1) }
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
|
||||
as(
|
||||
"als",
|
||||
fmta(
|
||||
[[
|
||||
\begin{align*}
|
||||
<>
|
||||
\end{align*}
|
||||
]],
|
||||
{ i(1) }
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
|
||||
as(
|
||||
"ali",
|
||||
fmta(
|
||||
[[
|
||||
\begin{align}
|
||||
<>
|
||||
\end{align}
|
||||
]],
|
||||
{ i(1) }
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue