diff options
author | Squibid <me@zacharyscheiman.com> | 2025-01-24 13:56:11 -0600 |
---|---|---|
committer | Squibid <me@zacharyscheiman.com> | 2025-01-24 13:56:11 -0600 |
commit | 8eaa615596be321a3be12378c5e7d65cc7e482b6 (patch) | |
tree | 53fe601048ea302962420de4feff465e4c7d9317 /lua/snippets/tex.lua | |
parent | a0ebc39b59a98a69fbb6abf150f86dc4e19987a3 (diff) | |
download | nvim-8eaa615596be321a3be12378c5e7d65cc7e482b6.tar.gz nvim-8eaa615596be321a3be12378c5e7d65cc7e482b6.tar.bz2 nvim-8eaa615596be321a3be12378c5e7d65cc7e482b6.zip |
Diffstat (limited to 'lua/snippets/tex.lua')
-rw-r--r-- | lua/snippets/tex.lua | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/lua/snippets/tex.lua b/lua/snippets/tex.lua new file mode 100644 index 0000000..0e87437 --- /dev/null +++ b/lua/snippets/tex.lua @@ -0,0 +1,70 @@ +require('core.snippets.shorthands') +require('core.snippets.functions') + +return { + -- document snippet + s("doc", + fmta( + [[ + \documentclass{article} + \title{<>} + \author{<>} + \begin{document} + \maketitle + <> + \end{document} + ]], + { + c(1, { + sn(nil, { f(file_name, {}), i(1) }), + i(1, "my title") + }), + i(2, "my name"), + i(0) + } + ) + ), + + s({ trig = ";begin", snippetType = "autosnippet" }, + fmta( + [[ + \begin{<>} + <> + \end{<>} + ]], + { + i(1), + i(0), + rep(1) + } + ) + ), + + s({ trig = ";href", snippetType = "autosnippet" }, + fmta( + [[\href{<>}{<>}]], + { + i(1, "url"), + i(2, "display name"), + } + ) + ), + + postfix(".b", { + f(function(_, parent) + return [[\textbf{]]..parent.snippet.env.POSTFIX_MATCH.."}" + end) + }), + + postfix(".i", { + f(function(_, parent) + return [[\textit{]]..parent.snippet.env.POSTFIX_MATCH.."}" + end) + }), + + postfix(".ul", { + f(function(_, parent) + return [[\underline{]]..parent.snippet.env.POSTFIX_MATCH.."}" + end) + }) +} |