From b0ced4b3dbd3daa16e1bb5e40fb4ceffe9fee91a Mon Sep 17 00:00:00 2001 From: Ben Lubas Date: Mon, 5 Aug 2024 09:37:03 -0400 Subject: [PATCH] fix(ToC): only try to open when still in norg buffer --- lua/neorg/modules/core/qol/toc/module.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/neorg/modules/core/qol/toc/module.lua b/lua/neorg/modules/core/qol/toc/module.lua index ca8fce675..b909be6c3 100644 --- a/lua/neorg/modules/core/qol/toc/module.lua +++ b/lua/neorg/modules/core/qol/toc/module.lua @@ -48,8 +48,12 @@ module.load = function() pattern = "*.norg", callback = function() vim.schedule(function() - next_open_is_auto = true - vim.cmd([[Neorg toc]]) + if + vim.api.nvim_get_option_value("filetype", { buf = vim.api.nvim_get_current_buf() }) == "norg" + then + next_open_is_auto = true + vim.cmd([[Neorg toc]]) + end end) end, })