File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
lua/luasnip-latex-snippets/util Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ function M.in_text(check_parent)
4949 return true
5050end
5151
52- function M . in_mathzone ()
52+ local function check_in_mathzone ()
5353 local node = get_node_at_cursor ()
5454 while node do
5555 if node :type () == " text_mode" then
@@ -62,4 +62,21 @@ function M.in_mathzone()
6262 return false
6363end
6464
65+ vim .api .nvim_create_autocmd ({" BufEnter" , " BufWinEnter" },
66+ {pattern = {" *.md" },
67+ callback = function ()
68+ if not vim .b .tracking_math then
69+ vim .api .nvim_buf_attach (0 , false , {on_lines = function (...)
70+ vim .b .in_mathzone = check_in_mathzone ()
71+ end })
72+ vim .b .in_mathzone = false
73+ vim .b .tracking_math = true
74+ end
75+ end
76+ })
77+
78+ function M .in_mathzone ()
79+ return vim .b .in_mathzone
80+ end
81+
6582return M
You can’t perform that action at this time.
0 commit comments