Add latex snippets
This commit is contained in:
parent
b56400c12c
commit
d9671f74c7
@ -13,7 +13,7 @@ local d = ls.dynamic_node
|
|||||||
local fmt = require("luasnip.extras.fmt").fmt
|
local fmt = require("luasnip.extras.fmt").fmt
|
||||||
local fmta = require("luasnip.extras.fmt").fmta
|
local fmta = require("luasnip.extras.fmt").fmta
|
||||||
local rep = require("luasnip.extras").rep
|
local rep = require("luasnip.extras").rep
|
||||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
local conds = require("luasnip.extras.expand_conditions")
|
||||||
|
|
||||||
---------------
|
---------------
|
||||||
-- Environments
|
-- Environments
|
||||||
@ -90,7 +90,7 @@ s({trig="notes"},
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
s({trig="beg"},
|
s({trig="beg", wordTrig=true, snippetType="autosnippet", condition=conds.line_begin},
|
||||||
fmta(
|
fmta(
|
||||||
[[
|
[[
|
||||||
\begin{<>}
|
\begin{<>}
|
||||||
@ -105,6 +105,46 @@ s({trig="beg"},
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
|
s({trig="item", wordTrig=true, snippetType="autosnippet",
|
||||||
|
condition = function(line_to_cursor, matched_trigger, captures)
|
||||||
|
return tex_utils.in_env("itemize") and conds.line_begin(line_to_cursor, matched_trigger, captures)
|
||||||
|
end},
|
||||||
|
fmta(
|
||||||
|
[[
|
||||||
|
\item <>
|
||||||
|
]],
|
||||||
|
{
|
||||||
|
i(0),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
|
s({trig="item", wordTrig=true, snippetType="autosnippet", condition=conds.line_begin},
|
||||||
|
fmta(
|
||||||
|
[[
|
||||||
|
\begin{itemize}
|
||||||
|
\item <>
|
||||||
|
\end{itemize}
|
||||||
|
]],
|
||||||
|
{
|
||||||
|
i(0),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
|
s({trig="frame", wordTrig=true, snippetType="autosnippet", condition=conds.line_begin},
|
||||||
|
fmta(
|
||||||
|
[[
|
||||||
|
\begin{frame}
|
||||||
|
\frametitle{<>}
|
||||||
|
\end{frame}
|
||||||
|
]],
|
||||||
|
{
|
||||||
|
i(0),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
s({trig="sec"},
|
s({trig="sec"},
|
||||||
fmta(
|
fmta(
|
||||||
[[
|
[[
|
||||||
|
|||||||
@ -13,6 +13,7 @@ local d = ls.dynamic_node
|
|||||||
local fmt = require("luasnip.extras.fmt").fmt
|
local fmt = require("luasnip.extras.fmt").fmt
|
||||||
local fmta = require("luasnip.extras.fmt").fmta
|
local fmta = require("luasnip.extras.fmt").fmta
|
||||||
local rep = require("luasnip.extras").rep
|
local rep = require("luasnip.extras").rep
|
||||||
|
local conds = require("luasnip.extras.expand_conditions")
|
||||||
|
|
||||||
|
|
||||||
---------------
|
---------------
|
||||||
@ -56,7 +57,7 @@ end
|
|||||||
return {
|
return {
|
||||||
|
|
||||||
|
|
||||||
s({trig="ali", snippetType="autosnippet"},
|
s({trig="ali", wordTrig=true, snippetType="autosnippet", condition=conds.line_begin},
|
||||||
fmta(
|
fmta(
|
||||||
[[
|
[[
|
||||||
\begin{align*}
|
\begin{align*}
|
||||||
@ -113,6 +114,21 @@ s({trig="matp"},
|
|||||||
{condition = tex_utils.in_mathzone}
|
{condition = tex_utils.in_mathzone}
|
||||||
),
|
),
|
||||||
|
|
||||||
|
s({trig="([^%a])array", regTrig=true, wordTrig=false, snippetType="autosnippet"},
|
||||||
|
fmta(
|
||||||
|
[[
|
||||||
|
<>\begin{array}{c}
|
||||||
|
<>
|
||||||
|
\end{array}
|
||||||
|
]],
|
||||||
|
{
|
||||||
|
f( function(_, snip) return snip.captures[1] end ),
|
||||||
|
i(0),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
{condition = tex_utils.in_mathzone}
|
||||||
|
),
|
||||||
|
|
||||||
s({trig='([^%a])int', regTrig=true, wordTrig=false, snippetType="autosnippet"},
|
s({trig='([^%a])int', regTrig=true, wordTrig=false, snippetType="autosnippet"},
|
||||||
fmta(
|
fmta(
|
||||||
[[<>\int_{<>}^{<>} <> d<> ]],
|
[[<>\int_{<>}^{<>} <> d<> ]],
|
||||||
@ -228,13 +244,13 @@ s({trig="([^%a])tt", regTrig=true, wordTrig=false, snippetType="autosnippet"},
|
|||||||
{condition = tex_utils.in_mathzone}
|
{condition = tex_utils.in_mathzone}
|
||||||
),
|
),
|
||||||
|
|
||||||
s({trig=".", snippetType="autosnippet"},
|
-- s({trig=".", snippetType="autosnippet"},
|
||||||
fmta(
|
-- fmta(
|
||||||
[[\cdot ]],
|
-- [[\cdot ]],
|
||||||
{}
|
-- {}
|
||||||
),
|
-- ),
|
||||||
{condition = tex_utils.in_mathzone}
|
-- {condition = tex_utils.in_mathzone}
|
||||||
),
|
-- ),
|
||||||
|
|
||||||
s({trig="$$", snippetType="autosnippet"},
|
s({trig="$$", snippetType="autosnippet"},
|
||||||
fmta(
|
fmta(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user