From ef9fc2ce6614565a5bdc166bc07e206702682381 Mon Sep 17 00:00:00 2001 From: pysan3 Date: Fri, 24 Nov 2023 00:05:36 +0900 Subject: [PATCH] fix(module): `snippets_overwrite` does nothing closes: #19 --- lua/neorg/modules/external/templates/module.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lua/neorg/modules/external/templates/module.lua b/lua/neorg/modules/external/templates/module.lua index f9c600d..e7fd811 100644 --- a/lua/neorg/modules/external/templates/module.lua +++ b/lua/neorg/modules/external/templates/module.lua @@ -183,10 +183,17 @@ module.load = function() end -- Add user defined snippets and append keywords - default_snippets = vim.tbl_deep_extend("force", default_snippets, module.config.public.snippets_overwrite) - snippet_handler.add_keywords(default_snippets.default_keywords) + for key, value in pairs(module.config.public.snippets_overwrite) do + local default_value = default_snippets[key] + if type(value) == "table" and type(default_value) == "table" then + default_snippets[key] = vim.tbl_deep_extend("force", default_value, value) + else + default_snippets[key] = value + end + end + snippet_handler.add_keywords(default_snippets.default_keywords or {}) snippet_handler.add_keywords(module.config.public.keywords or {}) - snippet_handler.magic_keywords = default_snippets.magic_keywords + snippet_handler.magic_keywords = default_snippets.magic_keywords or {} end module.on_event = function(event)