From 6e4065cfbcbc035bd96d133c7814115726acb315 Mon Sep 17 00:00:00 2001 From: Snoweuph Date: Sun, 19 Apr 2026 18:08:43 +0200 Subject: [PATCH 1/4] chore: drop injection comments --- .../plugins/completion/blink-cmp/config.nix | 29 ++++++++----------- modules/plugins/lsp/lspsaga/lspsaga.nix | 9 ++---- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/modules/plugins/completion/blink-cmp/config.nix b/modules/plugins/completion/blink-cmp/config.nix index 7b29b380..76f8a7eb 100644 --- a/modules/plugins/completion/blink-cmp/config.nix +++ b/modules/plugins/completion/blink-cmp/config.nix @@ -54,13 +54,10 @@ in { # event = ["InsertEnter" "CmdlineEnter"]; after = - # lua - '' - ${optionalString (config.vim.lazy.enable && cmpCfg.enable) - (concatStringsSep "\n" (map - (package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})") - cmpCfg.sourcePlugins))} - ''; + optionalString (config.vim.lazy.enable && cmpCfg.enable) + (concatStringsSep "\n" (map + (package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})") + cmpCfg.sourcePlugins)); }; }; @@ -111,18 +108,16 @@ in { next = [ "select_next" "snippet_forward" - (mkLuaInline - # lua - '' - function(cmp) - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - has_words_before = col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + (mkLuaInline '' + function(cmp) + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + has_words_before = col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil - if has_words_before then - return cmp.show() - end + if has_words_before then + return cmp.show() end - '') + end + '') "fallback" ]; previous = [ diff --git a/modules/plugins/lsp/lspsaga/lspsaga.nix b/modules/plugins/lsp/lspsaga/lspsaga.nix index 570cee1a..f70c8c9d 100644 --- a/modules/plugins/lsp/lspsaga/lspsaga.nix +++ b/modules/plugins/lsp/lspsaga/lspsaga.nix @@ -11,12 +11,9 @@ uiKindSetupOpts = if config.vim.theme.enable && config.vim.theme.name == "catppuccin" then { - ui.kind = - mkLuaInline - # lua - '' - require("catppuccin.groups.integrations.lsp_saga").custom_kind() - ''; + ui.kind = mkLuaInline '' + require("catppuccin.groups.integrations.lsp_saga").custom_kind() + ''; } else {}; in { From c4b940239b17ad2f58eeaaa86c1e3900721a9c58 Mon Sep 17 00:00:00 2001 From: Snoweuph Date: Sun, 19 Apr 2026 18:37:19 +0200 Subject: [PATCH 2/4] languages/nix: add more nvf injections --- docs/manual/release-notes/rl-0.9.md | 2 +- modules/plugins/languages/nix.nix | 82 ++++++++++++++++------------- 2 files changed, 46 insertions(+), 38 deletions(-) diff --git a/docs/manual/release-notes/rl-0.9.md b/docs/manual/release-notes/rl-0.9.md index 1975bb91..c56ccc50 100644 --- a/docs/manual/release-notes/rl-0.9.md +++ b/docs/manual/release-notes/rl-0.9.md @@ -274,7 +274,7 @@ - Added {option}`vim.treesitter.queries` to support adding custom queries. - Added injections for `vim.treesitter.queries.*.content` as `query` and - `mkLualine ""` as `lua`. + `mkLualine`, `entryAnywhere`, `entryBefore`, `entryAfter` as `lua`. - Added `vim.lsp.presets.` to contain LSP configurations. This allows for more flexibility in nvf and reuse of LSPs across languages. Dropped diff --git a/modules/plugins/languages/nix.nix b/modules/plugins/languages/nix.nix index 3c4a05ed..09507a55 100644 --- a/modules/plugins/languages/nix.nix +++ b/modules/plugins/languages/nix.nix @@ -138,44 +138,43 @@ in { filetypes = ["nix"]; content = '' ;; extends - ( - (binding - attrpath: (attrpath - (identifier) @_a - (identifier) @_b - (identifier)? @_c) - (#eq? @_a "vim") - (#any-of? @_b "treesitter") - (#any-of? @_c "queries") - expression: (attrset_expression - (binding_set - (binding - attrpath: (attrpath - (identifier) @_queries) - (#eq? @_queries "queries") + ((binding + attrpath: (attrpath + (identifier) @_a + (identifier) @_b + (identifier)? @_c) + (#eq? @_a "vim") + (#any-of? @_b "treesitter") + (#any-of? @_c "queries") - expression: (list_expression - (attrset_expression - (binding_set - (binding - attrpath: (attrpath - (identifier) @_field) - (#eq? @_field "content") + expression: (attrset_expression + (binding_set + (binding + attrpath: (attrpath + (identifier) @_queries) + (#eq? @_queries "queries") - expression: [ - (string_expression - (string_fragment) @injection.content) - (indented_string_expression - (string_fragment) @injection.content) - ] + expression: (list_expression + (attrset_expression + (binding_set + (binding + attrpath: (attrpath + (identifier) @_field) + (#eq? @_field "content") - (#set! injection.language "query") - (#set! injection.combined))))))))) - ) + expression: [ + (string_expression + (string_fragment) @injection.content) + (indented_string_expression + (string_fragment) @injection.content) + ] + + (#set! injection.language "query") + (#set! injection.combined)))))))))) ''; } - # mkLuaInline = lua + # mkLuaInline, entryAnywhere, entryBefore, entryAfter = lua { type = "injections"; filetypes = ["nix"]; @@ -185,13 +184,22 @@ in { ((apply_expression function: (variable_expression name: (identifier) @_func - (#eq? @_func "mkLuaInline")) - + (#any-of? @_func "mkLuaInline" "entryAnywhere")) argument: (indented_string_expression - (string_fragment) @injection.content) + (string_fragment) @injection.content)) + (#set! injection.language "lua") + (#set! injection.combined)) - (#set! injection.language "lua") - (#set! injection.combined))) + ((apply_expression + function: (apply_expression + function: (variable_expression + name: (identifier) @_func + (#any-of? @_func "entryBefore" "entryAfter")) + argument: (_)) + argument: (indented_string_expression + (string_fragment) @injection.content)) + (#set! injection.language "lua") + (#set! injection.combined)) ''; } ]; From 56db4e1cbd127cfd24bc73a97e473da3ef8f3e38 Mon Sep 17 00:00:00 2001 From: Snoweuph Date: Sun, 19 Apr 2026 18:51:41 +0200 Subject: [PATCH 3/4] languages/go: add injections for gotmpl --- docs/manual/release-notes/rl-0.9.md | 4 ++++ modules/extra/deprecations.nix | 1 + modules/plugins/languages/go.nix | 25 +++++++++++++++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/docs/manual/release-notes/rl-0.9.md b/docs/manual/release-notes/rl-0.9.md index c56ccc50..1d5040c8 100644 --- a/docs/manual/release-notes/rl-0.9.md +++ b/docs/manual/release-notes/rl-0.9.md @@ -104,6 +104,10 @@ - Renamed `languages.ts` to `languages.typescript`. +- Added {option}`vim.languages.go.treesitter.gotmpl.injection` and Renamed + `languages.go.treesitter.gotmplPackage` to + {option}`vim.languages.go.treesitter.gotmpl.package` + ## Changelog {#sec-release-0-9-changelog} [SecBear](https://github.com/SecBear): diff --git a/modules/extra/deprecations.nix b/modules/extra/deprecations.nix index 760b7b38..99785c2e 100644 --- a/modules/extra/deprecations.nix +++ b/modules/extra/deprecations.nix @@ -362,6 +362,7 @@ in { # 2026-04-19 [ (mkRenamedOptionModule ["vim" "utility" "vim-wakatime" "cli-path"] ["vim" "utility" "vim-wakatime" "setupOpts" "cli_path"]) + (mkRenamedOptionModule ["vim" "languages" "go" "treesitter" "gotmplPackage"] ["vim" "languages" "go" "treesitter" "gotmpl" "package"]) ] ]; } diff --git a/modules/plugins/languages/go.nix b/modules/plugins/languages/go.nix index 6831fe9c..afe9d1b2 100644 --- a/modules/plugins/languages/go.nix +++ b/modules/plugins/languages/go.nix @@ -143,7 +143,14 @@ in { gomodPackage = mkGrammarOption pkgs "gomod"; gosumPackage = mkGrammarOption pkgs "gosum"; goworkPackage = mkGrammarOption pkgs "gowork"; - gotmplPackage = mkGrammarOption pkgs "gotmpl"; + gotmpl = { + package = mkGrammarOption pkgs "gotmpl"; + injection = mkOption { + type = str; + default = "html"; + description = "Treesitter language to inject in Go templates"; + }; + }; }; lsp = { @@ -274,7 +281,21 @@ in { cfg.treesitter.gomodPackage cfg.treesitter.gosumPackage cfg.treesitter.goworkPackage - cfg.treesitter.gotmplPackage + cfg.treesitter.gotmpl.package + ]; + queries = [ + { + type = "injections"; + filetypes = ["gotmpl"]; + content = '' + ;; extends + + ((text) @injection.content + (#set! injection.language "${cfg.treesitter.gotmpl.injection}") + (#set! injection.combined) + ) + ''; + } ]; }; }) From fbb27a80c5e78f2ff2ec855c7d13009da6ea0e77 Mon Sep 17 00:00:00 2001 From: Snoweuph Date: Sun, 19 Apr 2026 19:02:24 +0200 Subject: [PATCH 4/4] languages/tera: add injection --- docs/manual/release-notes/rl-0.9.md | 5 ++++- modules/plugins/languages/tera.nix | 27 ++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/docs/manual/release-notes/rl-0.9.md b/docs/manual/release-notes/rl-0.9.md index 1d5040c8..604a241b 100644 --- a/docs/manual/release-notes/rl-0.9.md +++ b/docs/manual/release-notes/rl-0.9.md @@ -278,7 +278,10 @@ - Added {option}`vim.treesitter.queries` to support adding custom queries. - Added injections for `vim.treesitter.queries.*.content` as `query` and - `mkLualine`, `entryAnywhere`, `entryBefore`, `entryAfter` as `lua`. + `mkLualine`, `entryAnywhere`, `entryBefore`, `entryAfter` as `lua` in nix. + +- Added {option}`vim.languages.tera.treesitter.injection` to configure, what + language the content is. - Added `vim.lsp.presets.` to contain LSP configurations. This allows for more flexibility in nvf and reuse of LSPs across languages. Dropped diff --git a/modules/plugins/languages/tera.nix b/modules/plugins/languages/tera.nix index 0a28014c..3135df9f 100644 --- a/modules/plugins/languages/tera.nix +++ b/modules/plugins/languages/tera.nix @@ -7,7 +7,7 @@ inherit (lib) genAttrs; inherit (lib.options) mkEnableOption literalExpression mkOption; inherit (lib.modules) mkIf mkMerge; - inherit (lib.types) enum listOf; + inherit (lib.types) enum listOf str; inherit (lib.nvim.types) mkGrammarOption; cfg = config.vim.languages.tera; @@ -26,6 +26,11 @@ in { defaultText = literalExpression "config.vim.languages.enableTreesitter"; }; package = mkGrammarOption pkgs "tera"; + injection = mkOption { + type = str; + default = "html"; + description = "Treesitter language to inject in Tera templates"; + }; }; lsp = { @@ -45,8 +50,24 @@ in { config = mkIf cfg.enable (mkMerge [ (mkIf cfg.treesitter.enable { - vim.treesitter.enable = true; - vim.treesitter.grammars = [cfg.treesitter.package]; + vim.treesitter = { + enable = true; + grammars = [cfg.treesitter.package]; + queries = [ + { + type = "injections"; + filetypes = ["tera"]; + content = '' + ;; extends + + ((content) @injection.content + (#set! injection.language "${cfg.treesitter.injection}") + (#set! injection.combined) + ) + ''; + } + ]; + }; }) (mkIf cfg.lsp.enable {