summaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorNanderty <psopka@sopka.ch>2023-10-12 22:25:33 +0200
committerNanderty <psopka@sopka.ch>2023-10-12 22:25:33 +0200
commit3c6845fdbc5f3448d2f99e444fed1c8758845866 (patch)
treefddf3d42b392a048ff72de0951744ee3a23b3d7c /lua
parentc78f40aa7d9869a20b6c7d20f73113a64fbac39d (diff)
downloadneovim-config-3c6845fdbc5f3448d2f99e444fed1c8758845866.tar.gz
neovim-config-3c6845fdbc5f3448d2f99e444fed1c8758845866.tar.bz2
neovim-config-3c6845fdbc5f3448d2f99e444fed1c8758845866.zip
Snippet improvements chemistry
Diffstat (limited to 'lua')
-rw-r--r--lua/Snippets/luasniphelperslatex.lua4
-rw-r--r--lua/Snippets/tex/chemistry.lua13
-rw-r--r--lua/Snippets/tex/colors.lua15
-rw-r--r--lua/Snippets/tex/environments.lua17
-rw-r--r--lua/Snippets/tex/figures.lua193
-rw-r--r--lua/Snippets/tex/general.lua31
-rw-r--r--lua/Snippets/tex/schemes.lua210
-rw-r--r--lua/Snippets/tex/tables.lua5
-rw-r--r--lua/Snippets/tex/units.lua12
9 files changed, 303 insertions, 197 deletions
diff --git a/lua/Snippets/luasniphelperslatex.lua b/lua/Snippets/luasniphelperslatex.lua
index 29599b3..f49f547 100644
--- a/lua/Snippets/luasniphelperslatex.lua
+++ b/lua/Snippets/luasniphelperslatex.lua
@@ -21,4 +21,8 @@ tex.in_figure = function()
return tex.in_env('figure')
end
+tex.in_scheme = function()
+ return tex.in_env('scheme')
+end
+
return tex
diff --git a/lua/Snippets/tex/chemistry.lua b/lua/Snippets/tex/chemistry.lua
index 3ae0e9d..3446fba 100644
--- a/lua/Snippets/tex/chemistry.lua
+++ b/lua/Snippets/tex/chemistry.lua
@@ -2,6 +2,19 @@ local tex = require('Snippets.luasniphelperslatex')
local helper = require('Snippets.luasniphelpers')
return {
+
+ s({ trig = 'nvc', snippetType = 'autosnippet' },
+ {
+ t('\\invacuo '),
+ }
+ ),
+
+ s({ trig = 'nmr', snippetType = 'autosnippet' },
+ {
+ t('\\NMR* '),
+ }
+ ),
+
s({ trig = 'chmr', snippetType = 'autosnippet' },
fmta(
'\\ch{ <> ->>[ <> ][ <> ] <> }\\par',
diff --git a/lua/Snippets/tex/colors.lua b/lua/Snippets/tex/colors.lua
new file mode 100644
index 0000000..ddc8e4d
--- /dev/null
+++ b/lua/Snippets/tex/colors.lua
@@ -0,0 +1,15 @@
+local helper = require('Snippets.luasniphelpers')
+
+return {
+
+ s({ trig = 'clr', snippetType = 'autosnippet' },
+ fmta(
+ '{\\color{<>}<>}',
+ {
+ i(1),
+ i(2),
+ }
+ )
+ ),
+
+}
diff --git a/lua/Snippets/tex/environments.lua b/lua/Snippets/tex/environments.lua
index 46e5ee5..1fa0301 100644
--- a/lua/Snippets/tex/environments.lua
+++ b/lua/Snippets/tex/environments.lua
@@ -32,4 +32,21 @@ return {
),
{ condition = helper.line_begin }
),
+
+ s({ trig = 'mnp', snippetType = 'autosnippet' },
+ fmta(
+ [[
+\begin{minipage}[<>]{<>\textwidth}
+ <>
+\end{minipage}
+]],
+ {
+ i(1),
+ i(2),
+ i(3),
+ }
+ ),
+ { condition = helper.line_begin }
+ ),
+
}
diff --git a/lua/Snippets/tex/figures.lua b/lua/Snippets/tex/figures.lua
index 81a4368..e2fddd5 100644
--- a/lua/Snippets/tex/figures.lua
+++ b/lua/Snippets/tex/figures.lua
@@ -3,51 +3,7 @@ local helper = require('Snippets.luasniphelpers')
return {
- s({ trig = 'chfig', snippetType = 'autosnippet' },
- fmta(
- [[
-\begin{figure}[!h]
- \centering
- \chemfig {
- <>
- }
- \caption{<>
- }
- \label{fig:<>}
-\end{figure}
-]],
- {
- i(1),
- i(2),
- i(3),
- }
- ),
- { condition = helper.line_begin }
- ),
- s({ trig = 'chsch', snippetType = 'autosnippet' },
- fmta(
- [[
-\begin{figure}[!h]
- \centering
- \schemestart
- \chemfig {
- <>
- }
- \schemestop
- \caption{<>
- }
- \label{fig:<>}
-\end{figure}
-]],
- {
- i(1),
- i(2),
- i(3),
- }
- ),
- { condition = helper.line_begin }
- ),
s({ trig = 'imfig', snippetType = 'autosnippet' },
fmta(
@@ -96,153 +52,4 @@ return {
{ condition = helper.line_begin }
),
- s({ trig = 'scm', snippetType = 'autosnippet' },
- fmta(
- [[
-\schemestart
-<>
-\schemestop
-]],
- {
- i(1),
- }
- ),
- { condition = tex.in_figure }
- ),
-
- s({ trig = 'sus', snippetType = 'autosnippet' },
- fmta(
- [[
-\subscheme {
- <>
-}
-]],
- {
- i(1),
- }
- ),
- { condition = tex.in_figure }
- ),
-
- s({ trig = 'chf', snippetType = 'autosnippet' },
- fmta(
- [[
-\chemfig {
- <>
-}
- ]],
- {
- i(1),
- }
- ),
- { condition = tex.in_figure }
- ),
-
- s({ trig = 'arr', snippetType = 'autosnippet' },
- fmta(
- '\\arrow(<>){<>}[<>]',
- {
- i(1),
- i(2),
- i(3),
- }
- ),
- { condition = tex.in_figure }
- ),
-
- s({ trig = 'move', snippetType = 'autosnippet' },
- fmta(
- [[
-\chemmove[shorten <<=<>,shorten >>=<>]{
- \draw(<>).. controls +(<>) and +(<>).. (<>);
-}
- ]],
- {
- i(1),
- i(2),
- i(3),
- i(4),
- i(5),
- i(6),
- }
- ),
- { condition = tex.in_figure }
- ),
-
- s({ trig = 'chr', snippetType = 'autosnippet' },
- fmta(
- '\\charge{<>}{<>}',
- {
- i(1),
- i(2),
- }
- ),
- { condition = tex.in_figure }
- ),
-
- s({ trig = 'brc', snippetType = 'autosnippet' },
- fmta(
- [[
-\polymerdelim[height = <>, depth = <>,
- open xshift=<>, close xshift=<>,
- indice = \!\!<>]
- {op<>}{cl<>}
-]],
- {
- i(1),
- i(2),
- i(3),
- i(4),
- i(5),
- i(6),
- i(7),
- }
- ),
- { condition = tex.in_figure }
- ),
-
- s({ trig = 'nme', snippetType = 'autosnippet' },
- fmta(
- [[
-\chemname{
- <>
-}{<>}
-]],
- {
- i(1),
- i(2),
- }
- ),
- { condition = tex.in_figure }
- ),
-
- s({ trig = 'omi', snippetType = 'autosnippet' },
- { t('\\ominus') },
- { condition = tex.in_figure }
- ),
-
- s({ trig = 'opl', snippetType = 'autosnippet' },
- { t('\\oplus') },
- { condition = tex.in_figure }
- ),
-
- s({ trig = 'crp', snippetType = 'autosnippet' },
- fmta(
- [[(-[::<>,0.2,,,draw=none]\oplus)]],
- {
- i(1),
- }
- ),
- { condition = tex.in_figure }
- ),
-
- s({ trig = 'crm', snippetType = 'autosnippet' },
- fmta(
- [[(-[::<>,0.2,,,draw=none]\ominus)]],
- {
- i(1),
- }
- ),
- { condition = tex.in_figure }
- ),
}
diff --git a/lua/Snippets/tex/general.lua b/lua/Snippets/tex/general.lua
index 089edef..b90e20b 100644
--- a/lua/Snippets/tex/general.lua
+++ b/lua/Snippets/tex/general.lua
@@ -38,6 +38,17 @@ return {
)
),
+ s({ trig = 'srt', snippetType = 'autosnippet' },
+ fmta(
+ '\\SIrange{<>}{<>}{<>}',
+ {
+ i(1),
+ i(2),
+ i(3),
+ }
+ )
+ ),
+
s({ trig = 'bft', snippetType = 'autosnippet' },
fmta(
'\\textbf{<>}',
@@ -47,7 +58,7 @@ return {
)
),
- s({ trig = 'tlc', snippetType = 'autosnippet' },
+ s({ trig = 'tlt', snippetType = 'autosnippet' },
fmta(
'\\textit{<>}',
{
@@ -56,6 +67,24 @@ return {
)
),
+ s({ trig = 'spt', snippetType = 'autosnippet' },
+ fmta(
+ '\\textsuperscript{<>}',
+ {
+ i(1),
+ }
+ )
+ ),
+
+
+ s({ trig = 'sbt', snippetType = 'autosnippet' },
+ fmta(
+ '\\textsubscript{<>}',
+ {
+ i(1),
+ }
+ )
+ ),
s({ trig = 'cte', snippetType = 'autosnippet' },
fmta(
'\\supercite{<>}',
diff --git a/lua/Snippets/tex/schemes.lua b/lua/Snippets/tex/schemes.lua
new file mode 100644
index 0000000..fcb6579
--- /dev/null
+++ b/lua/Snippets/tex/schemes.lua
@@ -0,0 +1,210 @@
+local tex = require('Snippets.luasniphelperslatex')
+local helper = require('Snippets.luasniphelpers')
+
+return {
+ s({ trig = 'chfig', snippetType = 'autosnippet' },
+ fmta(
+ [[
+\begin{scheme}[!h]
+ \centering
+ \chemfig {
+ <>
+ }
+ \caption{<>
+ }
+ \label{sch:<>}
+\end{scheme}
+]],
+ {
+ i(1),
+ i(2),
+ i(3),
+ }
+ ),
+ { condition = helper.line_begin }
+ ),
+
+ s({ trig = 'chsch', snippetType = 'autosnippet' },
+ fmta(
+ [[
+\begin{scheme}[!h]
+ \centering
+ \schemestart
+ \chemfig {
+ <>
+ }
+ \schemestop
+ \caption{<>
+ }
+ \label{sch:<>}
+\end{scheme}
+]],
+ {
+ i(1),
+ i(2),
+ i(3),
+ }
+ ),
+ { condition = helper.line_begin }
+ ),
+
+ s({ trig = 'scm', snippetType = 'autosnippet' },
+ fmta(
+ [[
+\schemestart
+<>
+\schemestop
+]],
+ {
+ i(1),
+ }
+ ),
+ { condition = tex.in_scheme }
+ ),
+
+ s({ trig = 'ssc', snippetType = 'autosnippet' },
+ fmta(
+ [[
+\subscheme {
+ <>
+}
+]],
+ {
+ i(1),
+ }
+ ),
+ { condition = tex.in_scheme }
+ ),
+
+ s({ trig = 'chf', snippetType = 'autosnippet' },
+ fmta(
+ [[
+\chemfig {
+ <>
+}
+ ]],
+ {
+ i(1),
+ }
+ ),
+ { condition = tex.in_scheme }
+ ),
+
+ s({ trig = 'arr', snippetType = 'autosnippet' },
+ fmta(
+ '\\arrow(<>){<>}[<>]',
+ {
+ i(1),
+ i(2),
+ i(3),
+ }
+ ),
+ { condition = tex.in_scheme }
+ ),
+
+ s({ trig = 'move', snippetType = 'autosnippet' },
+ fmta(
+ [[
+\chemmove[shorten <<=<>,shorten >>=<>]{
+ \draw(<>).. controls +(<>) and +(<>).. (<>);
+}
+ ]],
+ {
+ i(1),
+ i(2),
+ i(3),
+ i(4),
+ i(5),
+ i(6),
+ }
+ ),
+ { condition = tex.in_scheme }
+ ),
+
+ s({ trig = 'chr', snippetType = 'autosnippet' },
+ fmta(
+ '\\charge{<>}{<>}',
+ {
+ i(1),
+ i(2),
+ }
+ ),
+ { condition = tex.in_scheme }
+ ),
+
+ s({ trig = 'brc', snippetType = 'autosnippet' },
+ fmta(
+ [[
+\polymerdelim[height = <>, depth = <>,
+ open xshift=<>, close xshift=<>,
+ indice = \!\!<>]
+ {op<>}{cl<>}
+]],
+ {
+ i(1),
+ i(2),
+ i(3),
+ i(4),
+ i(5),
+ i(6),
+ i(7),
+ }
+ ),
+ { condition = tex.in_scheme }
+ ),
+
+ s({ trig = 'nme', snippetType = 'autosnippet' },
+ fmta(
+ [[
+\chemname{
+ <>
+}{<>}
+]],
+ {
+ i(1),
+ i(2),
+ }
+ ),
+ { condition = tex.in_scheme }
+ ),
+
+ s({ trig = 'omi', snippetType = 'autosnippet' },
+ { t('\\ominus') },
+ { condition = tex.in_scheme }
+ ),
+
+ s({ trig = 'rfr', snippetType = 'autosnippet' },
+ fmta(
+ [[ \ref{fig:<>}]],
+ {
+ i(1),
+ }
+ )
+ ),
+
+ s({ trig = 'opl', snippetType = 'autosnippet' },
+ { t('\\oplus') },
+ { condition = tex.in_scheme }
+ ),
+
+ s({ trig = 'crp', snippetType = 'autosnippet' },
+ fmta(
+ [[(-[::<>,0.4,,,draw=none]\oplus)]],
+ {
+ i(1),
+ }
+ ),
+ { condition = tex.in_scheme }
+ ),
+
+ s({ trig = 'crm', snippetType = 'autosnippet' },
+ fmta(
+ [[(-[::<>,0.4,,,draw=none]\ominus)]],
+ {
+ i(1),
+ }
+ ),
+ { condition = tex.in_scheme }
+ ),
+
+}
diff --git a/lua/Snippets/tex/tables.lua b/lua/Snippets/tex/tables.lua
index 80531e1..b2f39b3 100644
--- a/lua/Snippets/tex/tables.lua
+++ b/lua/Snippets/tex/tables.lua
@@ -1,5 +1,4 @@
local helper = require('Snippets.luasniphelpers')
-local helper = require('Snippets.luasniphelpers')
return {
@@ -13,7 +12,7 @@ return {
\end{tabular}
\caption{<>
}
- \label{fig:<>}
+ \label{tbl:<>}
\end{table}
]],
{
@@ -36,7 +35,7 @@ return {
\end{tabularx}
\caption{<>
}
- \label{fig:<>}
+ \label{tbl:<>}
\end{table}
]],
{
diff --git a/lua/Snippets/tex/units.lua b/lua/Snippets/tex/units.lua
new file mode 100644
index 0000000..c1e4f0b
--- /dev/null
+++ b/lua/Snippets/tex/units.lua
@@ -0,0 +1,12 @@
+local tex = require('Snippets.luasniphelperslatex')
+local helper = require('Snippets.luasniphelpers')
+
+return {
+
+ s({ trig = 'twd', snippetType = 'autosnippet' },
+ {
+ t('\\textwidth'),
+ }
+ ),
+
+}