Open mscott99 opened 1 year ago
Have you checked this works for all buffers (i.e. newly created)? I get the impression that on_attach will be called only once, for a single buffer.
Oh it seems that you are correct. Sometimes on_attach is not called. I have now fixed this, the buf_attach is now called with an autocommand each time we have a BufEnter or BufWinEnter. Also the is_math variable is now local to each buffer.
Do you have any profiling/benchmark? I'm curious on how many calls we're saving.
I don't, but I could run a quick check with some print statements or a counter to check the number of calls. I wont be able to do that right away though, probably in a week or so
I think the code was checking whether is_math for each snippet for which this was a condition. This pr changes that behaviour so that is_math is a local variable that updates anytime the buffer is modified, and then the is_math condition on the snippets will read off this local variable.