From af2d8df323741229217dd5ae40a61548c9617457 Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Wed, 11 Feb 2026 18:50:51 +0100 Subject: [PATCH] feat: add gotmpl --- init.lua | 5 +++-- lua/core/filetypes.lua | 5 +++++ lua/plugins/nvim-treesitter.lua | 1 + lua/plugins/onedark.lua | 1 + queries/gotmpl/injections.scm | 3 +++ 5 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 lua/core/filetypes.lua create mode 100644 queries/gotmpl/injections.scm diff --git a/init.lua b/init.lua index 8258ba2..95480e0 100644 --- a/init.lua +++ b/init.lua @@ -3,11 +3,12 @@ vim.loader.enable() local log = require("log") local files = { - "globals", - "options", "autocommands", "commands", + "filetypes", + "globals", "mappings", + "options", } for _, file in ipairs(files) do diff --git a/lua/core/filetypes.lua b/lua/core/filetypes.lua new file mode 100644 index 0000000..e6a5bbb --- /dev/null +++ b/lua/core/filetypes.lua @@ -0,0 +1,5 @@ +vim.filetype.add({ + pattern = { + [".*%.xml%.tmpl"] = "gotmpl", + }, +}) diff --git a/lua/plugins/nvim-treesitter.lua b/lua/plugins/nvim-treesitter.lua index 9f5e750..ab35f73 100644 --- a/lua/plugins/nvim-treesitter.lua +++ b/lua/plugins/nvim-treesitter.lua @@ -16,6 +16,7 @@ local languages = { "rust", "comment", "gitcommit", + "gotmpl", } ---@type LazyPluginSpec diff --git a/lua/plugins/onedark.lua b/lua/plugins/onedark.lua index edddca3..657c99b 100644 --- a/lua/plugins/onedark.lua +++ b/lua/plugins/onedark.lua @@ -8,6 +8,7 @@ return { local c = require("onedark.colors") local highlights = { ["@string.special.url"] = { fg = "NONE", fmt = "NONE" }, + ["@lsp.type.macro.gotmpl"] = { fg = "NONE", fmt = "NONE" }, Cursor = { fg = c.bg, bg = c.fg, fmt = "NONE" }, FloatTitle = { fg = c.orange, bg = c.bg_d }, NormalFloat = { bg = c.bg_d }, diff --git a/queries/gotmpl/injections.scm b/queries/gotmpl/injections.scm new file mode 100644 index 0000000..16d5736 --- /dev/null +++ b/queries/gotmpl/injections.scm @@ -0,0 +1,3 @@ +((text) @injection.content + (#set! injection.language "html") + (#set! injection.combined))