Add snippets for latex (frame)

This commit is contained in:
Fabrice Mouhartem 2024-05-14 12:09:20 +02:00
parent 029d95e75d
commit fd84aebebb
Signed by: fmouhart
GPG Key ID: 2C5033B228CFE4E7
2 changed files with 27 additions and 0 deletions

View File

@ -2,6 +2,7 @@
local cmp = require 'cmp' local cmp = require 'cmp'
local luasnip = require 'luasnip' local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load() require('luasnip.loaders.from_vscode').lazy_load()
require('luasnip.loaders.from_lua').lazy_load()
luasnip.config.setup { luasnip.config.setup {
history = true, history = true,
updateevents = "TextChanged,TextChangedI", updateevents = "TextChanged,TextChangedI",

26
luasnippets/tex.lua Normal file
View File

@ -0,0 +1,26 @@
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
return {
s({ trig = "frame", dscr = "A beamer frame" },
fmta(
[[
\begin{frame}{<>}
<>
\end{frame}
]],
{
i(1, "title"),
i(2, "content")
}
)
),
}