diff options
author | Yigit Sever | 2021-11-14 02:50:23 +0300 |
---|---|---|
committer | Yigit Sever | 2021-11-14 02:50:23 +0300 |
commit | 07fd9c5f4f905fd1335846eb8acfe815f9261504 (patch) | |
tree | 6045e68d595d97b188b71ed4b06f590c47068b66 /.config/nvim/my_snippets | |
parent | 061e2d6835a3b83eaa854bae11cb0627ed114767 (diff) | |
download | dotfiles-07fd9c5f4f905fd1335846eb8acfe815f9261504.tar.gz dotfiles-07fd9c5f4f905fd1335846eb8acfe815f9261504.tar.bz2 dotfiles-07fd9c5f4f905fd1335846eb8acfe815f9261504.zip |
nvim: latex snippets, treesitter was bad
Diffstat (limited to '.config/nvim/my_snippets')
-rw-r--r-- | .config/nvim/my_snippets/tex.snippets | 8 |
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 | ||
4 | global !p | ||
5 | def math(): | ||
6 | return vim.eval('vimtex#syntax#in_mathzone()') == '1' | ||
7 | endglobal | ||
8 | |||
4 | snippet template "Basic template" b | 9 | snippet template "Basic template" b |
5 | \documentclass[a4paper]{article} | 10 | \documentclass[a4paper]{article} |
6 | 11 | ||
@@ -96,14 +101,17 @@ ${1:${VISUAL}} | |||
96 | .\] $0 | 101 | .\] $0 |
97 | endsnippet | 102 | endsnippet |
98 | 103 | ||
104 | context "math()" | ||
99 | snippet '([A-Za-z])(\d)' "auto subscript" wrA | 105 | snippet '([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)` |
101 | endsnippet | 107 | endsnippet |
102 | 108 | ||
109 | context "math()" | ||
103 | snippet '([A-Za-z])_(\d\d)' "auto subscript2" wrA | 110 | snippet '([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)`} |
105 | endsnippet | 112 | endsnippet |
106 | 113 | ||
114 | context "math()" | ||
107 | snippet // "Fraction" iA | 115 | snippet // "Fraction" iA |
108 | \\frac{$1}{$2}$0 | 116 | \\frac{$1}{$2}$0 |
109 | endsnippet | 117 | endsnippet |