summaryrefslogtreecommitdiffstats
path: root/.config/nvim/my_snippets/tex.snippets
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/my_snippets/tex.snippets')
-rw-r--r--.config/nvim/my_snippets/tex.snippets8
1 files changed, 8 insertions, 0 deletions
diff --git a/.config/nvim/my_snippets/tex.snippets b/.config/nvim/my_snippets/tex.snippets
index 503221f..ea34781 100644
--- a/.config/nvim/my_snippets/tex.snippets
+++ b/.config/nvim/my_snippets/tex.snippets
@@ -1,6 +1,11 @@
1# vim:ft=snippets: 1# vim:ft=snippets:
2# https://castel.dev/post/lecture-notes-1/ 2# https://castel.dev/post/lecture-notes-1/
3 3
4global !p
5def math():
6 return vim.eval('vimtex#syntax#in_mathzone()') == '1'
7endglobal
8
4snippet template "Basic template" b 9snippet template "Basic template" b
5\documentclass[a4paper]{article} 10\documentclass[a4paper]{article}
6 11
@@ -96,14 +101,17 @@ ${1:${VISUAL}}
96.\] $0 101.\] $0
97endsnippet 102endsnippet
98 103
104context "math()"
99snippet '([A-Za-z])(\d)' "auto subscript" wrA 105snippet '([A-Za-z])(\d)' "auto subscript" wrA
100`!p snip.rv = match.group(1)`_`!p snip.rv = match.group(2)` 106`!p snip.rv = match.group(1)`_`!p snip.rv = match.group(2)`
101endsnippet 107endsnippet
102 108
109context "math()"
103snippet '([A-Za-z])_(\d\d)' "auto subscript2" wrA 110snippet '([A-Za-z])_(\d\d)' "auto subscript2" wrA
104`!p snip.rv = match.group(1)`_{`!p snip.rv = match.group(2)`} 111`!p snip.rv = match.group(1)`_{`!p snip.rv = match.group(2)`}
105endsnippet 112endsnippet
106 113
114context "math()"
107snippet // "Fraction" iA 115snippet // "Fraction" iA
108\\frac{$1}{$2}$0 116\\frac{$1}{$2}$0
109endsnippet 117endsnippet