File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
lua/luasnip-latex-snippets/util Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -49,8 +49,6 @@ function M.in_text(check_parent)
4949 return true
5050end
5151
52- local in_mathzone = false
53-
5452local function check_in_mathzone ()
5553 local node = get_node_at_cursor ()
5654 while node do
@@ -64,14 +62,21 @@ local function check_in_mathzone()
6462 return false
6563end
6664
67- vim .api .nvim_buf_attach (0 , false , {
68- on_lines = function (...)
69- in_mathzone = check_in_mathzone ()
70- end ,
71- })
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+ })
7277
7378function M .in_mathzone ()
74- return in_mathzone
79+ return vim . b . in_mathzone
7580end
7681
7782return M
You can’t perform that action at this time.
0 commit comments