summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYigit Sever2021-11-14 02:50:23 +0300
committerYigit Sever2021-11-14 02:50:23 +0300
commit07fd9c5f4f905fd1335846eb8acfe815f9261504 (patch)
tree6045e68d595d97b188b71ed4b06f590c47068b66
parent061e2d6835a3b83eaa854bae11cb0627ed114767 (diff)
downloaddotfiles-07fd9c5f4f905fd1335846eb8acfe815f9261504.tar.gz
dotfiles-07fd9c5f4f905fd1335846eb8acfe815f9261504.tar.bz2
dotfiles-07fd9c5f4f905fd1335846eb8acfe815f9261504.zip
nvim: latex snippets, treesitter was bad
-rw-r--r--.config/nvim/lua/plugin_settings.lua1
-rw-r--r--.config/nvim/my_snippets/tex.snippets8
2 files changed, 9 insertions, 0 deletions
diff --git a/.config/nvim/lua/plugin_settings.lua b/.config/nvim/lua/plugin_settings.lua
index 5b999fe..56612f5 100644
--- a/.config/nvim/lua/plugin_settings.lua
+++ b/.config/nvim/lua/plugin_settings.lua
@@ -254,6 +254,7 @@ require 'nvim-treesitter.configs'.setup {
254 ensure_installed = "maintained", 254 ensure_installed = "maintained",
255 highlight = { 255 highlight = {
256 enable = true, 256 enable = true,
257 disable = { "latex" },
257 additional_vim_regex_highlighting = false, 258 additional_vim_regex_highlighting = false,
258 }, 259 },
259 incremental_selection = { 260 incremental_selection = {
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