Updated vimtex and snippets
This commit is contained in:
parent
84a6b218fe
commit
10bf23a6ec
44 changed files with 4209 additions and 69 deletions
92
LuaSnip/tex/delimiter.lua
Normal file
92
LuaSnip/tex/delimiter.lua
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
local helpers = require('personal.luasnip-helper-funcs')
|
||||
local get_visual = helpers.get_visual
|
||||
|
||||
-- Math context detection
|
||||
local tex = {}
|
||||
tex.in_mathzone = function() return vim.fn['vimtex#syntax#in_mathzone']() == 1 end
|
||||
tex.in_text = function() return not tex.in_mathzone() end
|
||||
|
||||
-- Return snippet tables
|
||||
return
|
||||
{
|
||||
-- LEFT/RIGHT PARENTHESES
|
||||
s({trig = "([^%a])l%(", regTrig = true, wordTrig = false, snippetType="autosnippet"},
|
||||
fmta(
|
||||
"<>\\left(<>\\right)",
|
||||
{
|
||||
f( function(_, snip) return snip.captures[1] end ),
|
||||
d(1, get_visual),
|
||||
}
|
||||
)
|
||||
),
|
||||
-- LEFT/RIGHT SQUARE BRACES
|
||||
s({trig = "([^%a])l%[", regTrig = true, wordTrig = false, snippetType="autosnippet"},
|
||||
fmta(
|
||||
"<>\\left[<>\\right]",
|
||||
{
|
||||
f( function(_, snip) return snip.captures[1] end ),
|
||||
d(1, get_visual),
|
||||
}
|
||||
)
|
||||
),
|
||||
-- LEFT/RIGHT CURLY BRACES
|
||||
s({trig = "([^%a])l%{", regTrig = true, wordTrig = false, snippetType="autosnippet"},
|
||||
fmta(
|
||||
"<>\\left\\{<>\\right\\}",
|
||||
{
|
||||
f( function(_, snip) return snip.captures[1] end ),
|
||||
d(1, get_visual),
|
||||
}
|
||||
)
|
||||
),
|
||||
-- BIG PARENTHESES
|
||||
s({trig = "([^%a])b%(", regTrig = true, wordTrig = false, snippetType="autosnippet"},
|
||||
fmta(
|
||||
"<>\\big(<>\\big)",
|
||||
{
|
||||
f( function(_, snip) return snip.captures[1] end ),
|
||||
d(1, get_visual),
|
||||
}
|
||||
)
|
||||
),
|
||||
-- BIG SQUARE BRACES
|
||||
s({trig = "([^%a])b%[", regTrig = true, wordTrig = false, snippetType="autosnippet"},
|
||||
fmta(
|
||||
"<>\\big[<>\\big]",
|
||||
{
|
||||
f( function(_, snip) return snip.captures[1] end ),
|
||||
d(1, get_visual),
|
||||
}
|
||||
)
|
||||
),
|
||||
-- BIG CURLY BRACES
|
||||
s({trig = "([^%a])b%{", regTrig = true, wordTrig = false, snippetType="autosnippet"},
|
||||
fmta(
|
||||
"<>\\big\\{<>\\big\\}",
|
||||
{
|
||||
f( function(_, snip) return snip.captures[1] end ),
|
||||
d(1, get_visual),
|
||||
}
|
||||
)
|
||||
),
|
||||
-- ESCAPED CURLY BRACES
|
||||
s({trig = "([^%a])\\%{", regTrig = true, wordTrig = false, snippetType="autosnippet", priority=2000},
|
||||
fmta(
|
||||
"<>\\{<>\\}",
|
||||
{
|
||||
f( function(_, snip) return snip.captures[1] end ),
|
||||
d(1, get_visual),
|
||||
}
|
||||
)
|
||||
),
|
||||
-- LATEX QUOTATION MARK
|
||||
s({trig = "``", snippetType="autosnippet"},
|
||||
fmta(
|
||||
"``<>''",
|
||||
{
|
||||
d(1, get_visual),
|
||||
}
|
||||
)
|
||||
),
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue