From e17677341b4c7b2961597aec6ad194e38f17720c Mon Sep 17 00:00:00 2001 From: danymat Date: Tue, 8 Feb 2022 15:34:47 +0100 Subject: [PATCH] feat: Allow getting template for current filetype --- lua/neogen/init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/neogen/init.lua b/lua/neogen/init.lua index 83e4a0e..d368eba 100644 --- a/lua/neogen/init.lua +++ b/lua/neogen/init.lua @@ -107,7 +107,7 @@ neogen.configuration = { input_after_comment = true, -- Configuration for default languages - languages = {} + languages = {}, } --minidoc_afterlines_end @@ -138,11 +138,11 @@ end neogen.match_commands = helpers.match_commands --- Get a template for a particular filetype ----@param filetype string +---@param filetype? string ---@return neogen.TemplateConfig|nil neogen.get_template = function(filetype) local template - local ft_conf = conf.languages[filetype] + local ft_conf = filetype and conf.languages[filetype] or conf.languages[vim.bo.filetype] if ft_conf and ft_conf.template then template = ft_conf.template end