From 930e71d0ce24d11a039d8d54473838114b3a6ece Mon Sep 17 00:00:00 2001 From: jules Date: Sat, 13 Sep 2025 11:02:58 -0400 Subject: [PATCH 01/53] fix(blink-cmp): added keymap "inherit" preset "inherit" preset is valid for non-default completion modes (cmdline, terminal, etc), allowing that mode to inherit the default keymaps. --- docs/release-notes/rl-0.8.md | 3 +++ modules/plugins/completion/blink-cmp/blink-cmp.nix | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 74a94b9c..d3be5a1a 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -499,3 +499,6 @@ - Add [nvim-highlight-colors] plugin in `vim.ui.nvim-highlight-colors` with `enable` and `setupOpts` +- Fix [blink.cmp] keymap preset types to allow alternate cmdline, terminal, + etc modes to `inherit` the default mode keymaps. This is an option as per + the [blink.cmp] docs and is now supported in docs and is now supported in nvf.nvf. diff --git a/modules/plugins/completion/blink-cmp/blink-cmp.nix b/modules/plugins/completion/blink-cmp/blink-cmp.nix index d07c777e..d0f0328a 100644 --- a/modules/plugins/completion/blink-cmp/blink-cmp.nix +++ b/modules/plugins/completion/blink-cmp/blink-cmp.nix @@ -9,7 +9,7 @@ freeformType = attrsOf (listOf (either str luaInline)); options = { preset = mkOption { - type = enum ["default" "none" "super-tab" "enter" "cmdline"]; + type = enum ["inherit" "default" "none" "super-tab" "enter" "cmdline"]; default = "none"; description = "keymap presets"; }; From 96e1004e5542e1154bbd465e073ac9756b65f0f4 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Mon, 15 Sep 2025 18:44:30 +0200 Subject: [PATCH 02/53] nix: fix nixd option --- modules/plugins/languages/nix.nix | 32 ++++++++++++------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/modules/plugins/languages/nix.nix b/modules/plugins/languages/nix.nix index 76310459..7d126e15 100644 --- a/modules/plugins/languages/nix.nix +++ b/modules/plugins/languages/nix.nix @@ -60,7 +60,17 @@ ''; }; - nixd = { + nixd = let + settings.nixd = { + inherit (cfg.lsp) options; + formatting.command = + if !cfg.format.enable + then null + else if cfg.format.type == "alejandra" + then ["${cfg.format.package}/bin/alejandra" "--quiet"] + else ["${cfg.format.package}/bin/nixfmt"]; + }; + in { package = pkgs.nixd; internalFormatter = true; lspConfig = '' @@ -72,25 +82,7 @@ else noFormat }, cmd = ${packageToCmd cfg.lsp.package "nixd"}, - options = ${toLuaObject cfg.lsp.options}, - ${optionalString cfg.format.enable '' - settings = { - nixd = { - ${optionalString (cfg.format.type == "alejandra") - '' - formatting = { - command = {"${cfg.format.package}/bin/alejandra", "--quiet"}, - }, - ''} - ${optionalString (cfg.format.type == "nixfmt") - '' - formatting = { - command = {"${cfg.format.package}/bin/nixfmt"}, - }, - ''} - }, - }, - ''} + settings = ${toLuaObject settings}, } ''; }; From b7571df4d6e9ac08506a738ddceeec0b141751b0 Mon Sep 17 00:00:00 2001 From: Party Wumpus <48649272+PartyWumpus@users.noreply.github.com> Date: Fri, 19 Sep 2025 09:47:41 +0100 Subject: [PATCH 03/53] languages/typst: Add inline preview via typst-concealer (#588) * add typst-concealer * Update modules/plugins/languages/typst.nix Co-authored-by: raf * add keybinds, resolve review etc * add changes back (it was easier than a rebase here) * add the newer conceal_in_normal option * run deno fmt * add "typ" to typos --------- Co-authored-by: raf --- .github/typos.toml | 1 + docs/release-notes/rl-0.8.md | 7 +++ modules/plugins/languages/typst.nix | 67 ++++++++++++++++++++++++++++- npins/sources.json | 13 ++++++ 4 files changed, 87 insertions(+), 1 deletion(-) diff --git a/.github/typos.toml b/.github/typos.toml index 2cd18dde..26be7d9b 100644 --- a/.github/typos.toml +++ b/.github/typos.toml @@ -5,6 +5,7 @@ default.extend-ignore-words-re = [ "befores", "annote", "viw", + "typ", "BA", # somehow "BANanaD3V" is valid, but BA is not... ] diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 74a94b9c..82b3c77e 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -499,3 +499,10 @@ - Add [nvim-highlight-colors] plugin in `vim.ui.nvim-highlight-colors` with `enable` and `setupOpts` + +[PartyWumpus](https://github.com/PartyWumpus): + +[typst-concealer]: https://github.com/PartyWumpus/typst-concealer + +- Add inline typst concealing support under `vim.languages.typst` using + [typst-concealer]. diff --git a/modules/plugins/languages/typst.nix b/modules/plugins/languages/typst.nix index 08a2252b..32bce676 100644 --- a/modules/plugins/languages/typst.nix +++ b/modules/plugins/languages/typst.nix @@ -7,9 +7,10 @@ inherit (lib.options) mkEnableOption mkOption; inherit (lib.modules) mkIf mkMerge; inherit (lib.lists) isList; - inherit (lib.types) nullOr enum either attrsOf listOf package str; + inherit (lib.types) nullOr enum either attrsOf listOf package str bool int; inherit (lib.attrsets) attrNames; inherit (lib.meta) getExe; + inherit (lib.nvim.binds) mkMappingOption mkKeymap; inherit (lib.nvim.lua) expToLua toLuaObject; inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption; inherit (lib.nvim.dag) entryAnywhere; @@ -150,6 +151,57 @@ in { }; }; }; + typst-concealer = { + enable = mkEnableOption '' + [typst-concealer]: https://github.com/PartyWumpus/typst-concealer + + Inline typst preview for Neovim via [typst-concealer] + ''; + + mappings = { + toggleConcealing = mkMappingOption "Enable typst-concealer in buffer" "TT"; + }; + + setupOpts = mkPluginSetupOption "typst-concealer" { + do_diagnostics = mkOption { + type = nullOr bool; + default = !cfg.lsp.enable; + description = "Should typst-concealer provide diagnostics on error?"; + }; + color = mkOption { + type = nullOr str; + default = null; + example = "rgb(\"#f012be\")"; + description = "What color should typst-concealer render text/stroke with? (only applies when styling_type is 'colorscheme')"; + }; + enabled_by_default = mkOption { + type = nullOr bool; + default = null; + description = "Should typst-concealer conceal newly opened buffers by default?"; + }; + styling_type = mkOption { + type = nullOr (enum ["simple" "none" "colorscheme"]); + default = null; + description = "What kind of styling should typst-concealer apply to your typst?"; + }; + ppi = mkOption { + type = nullOr int; + default = null; + description = "What PPI should typst render at. Plugin default is 300, typst's normal default is 144."; + }; + typst_location = mkOption { + type = str; + default = getExe pkgs.typst; + description = "Where should typst-concealer look for your typst binary?"; + example = ''lib.getExe pkgs.typst''; + }; + conceal_in_normal = mkOption { + type = nullOr bool; + default = null; + description = "Should typst-concealer still conceal when the normal mode cursor goes over a line."; + }; + }; + }; }; }; config = mkIf cfg.enable (mkMerge [ @@ -180,5 +232,18 @@ in { require("typst-preview").setup(${toLuaObject cfg.extensions.typst-preview-nvim.setupOpts}) ''; }) + + (mkIf cfg.extensions.typst-concealer.enable { + vim.lazy.plugins.typst-concealer = { + event = "BufRead *.typ"; + package = "typst-concealer"; + setupModule = "typst-concealer"; + setupOpts = cfg.extensions.typst-concealer.setupOpts; + + keys = [ + (mkKeymap "n" cfg.extensions.typst-concealer.mappings.toggleConcealing "lua require('typst-concealer').toggle_buf()" {desc = "Toggle typst-concealer in buffer";}) + ]; + }; + }) ]); } diff --git a/npins/sources.json b/npins/sources.json index cf4bb564..ff8662f3 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -2526,6 +2526,19 @@ "url": "https://github.com/dmmulroy/ts-error-translator.nvim/archive/47e5ba89f71b9e6c72eaaaaa519dd59bd6897df4.tar.gz", "hash": "08whn7l75qv5n74cifmnxc0s7n7ja1g7589pjnbbsk2djn6bqbky" }, + "typst-concealer": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "PartyWumpus", + "repo": "typst-concealer" + }, + "branch": "main", + "submodules": false, + "revision": "3d2e72ce7fc06bd0db0dafbdd1e17d3c9e343d53", + "url": "https://github.com/PartyWumpus/typst-concealer/archive/3d2e72ce7fc06bd0db0dafbdd1e17d3c9e343d53.tar.gz", + "hash": "16j3q3hk1wzgcz6snn9997vclhkanplyn0cp1dm9lk034jd8v9nh" + }, "typst-preview-nvim": { "type": "Git", "repository": { From 74d6fe86e63e94a015a1911cdc33895a2c203766 Mon Sep 17 00:00:00 2001 From: alfarel Date: Sun, 7 Sep 2025 00:47:04 +0000 Subject: [PATCH 04/53] languages/markdown: add markdown-oxide server option --- docs/release-notes/rl-0.8.md | 2 ++ modules/plugins/languages/markdown.nix | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 4f8e0a79..b4dd42b4 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -289,6 +289,8 @@ - Fix [blink.cmp] breaking when built-in sources were modified. - Fix [conform.nvim] not allowing disabling formatting on and after save. Use `null` value to disable them if conform is enabled. +- Add [markdown-oxide](https://github.com/Feel-ix-343/markdown-oxide) option to + markdown language module. [TheColorman](https://github.com/TheColorman): diff --git a/modules/plugins/languages/markdown.nix b/modules/plugins/languages/markdown.nix index 0a3f0945..a619e3c8 100644 --- a/modules/plugins/languages/markdown.nix +++ b/modules/plugins/languages/markdown.nix @@ -23,6 +23,13 @@ filetypes = ["markdown" "markdown.mdx"]; root_markers = [".marksman.toml" ".git"]; }; + + markdown-oxide = { + enable = true; + cmd = [(getExe pkgs.markdown-oxide)]; + filetypes = ["markdown"]; + root_markers = [".git" ".obsidian" ".moxide.toml"]; + }; }; defaultFormat = "deno_fmt"; From d26b9dc896c7ba9b44368a2339e5930b9d0afd4e Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Thu, 25 Sep 2025 23:49:41 +0200 Subject: [PATCH 05/53] autocmds: ensure augroups are set up before autocmds --- modules/neovim/init/autocmds.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/neovim/init/autocmds.nix b/modules/neovim/init/autocmds.nix index 07656134..579a211e 100644 --- a/modules/neovim/init/autocmds.nix +++ b/modules/neovim/init/autocmds.nix @@ -9,7 +9,7 @@ inherit (lib.types) nullOr submodule listOf str bool; inherit (lib.nvim.types) luaInline; inherit (lib.nvim.lua) toLuaObject; - inherit (lib.nvim.dag) entryAfter; + inherit (lib.nvim.dag) entryAfter entryBetween; autocommandType = submodule { options = { @@ -144,7 +144,7 @@ in { enabledAutogroups = filter (au: au.enable) cfg.augroups; in { luaConfigRC = { - augroups = entryAfter ["pluginConfigs"] (optionalString (enabledAutogroups != []) '' + augroups = entryBetween ["autocmds"] ["pluginConfigs"] (optionalString (enabledAutogroups != []) '' local nvf_autogroups = {} for _, group in ipairs(${toLuaObject enabledAutogroups}) do if group.name then From e1fd607e3f2ac22bb67be2e07dd14f8f40e889c3 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Fri, 26 Sep 2025 00:01:30 +0200 Subject: [PATCH 06/53] lsp: call default_on_attach in LspAttach autocmd --- modules/plugins/lsp/config.nix | 38 ++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/modules/plugins/lsp/config.nix b/modules/plugins/lsp/config.nix index e7b67c8e..b104ef85 100644 --- a/modules/plugins/lsp/config.nix +++ b/modules/plugins/lsp/config.nix @@ -10,6 +10,8 @@ inherit (lib.strings) optionalString; inherit (lib.trivial) boolToString; inherit (lib.nvim.binds) addDescriptionsToMappings; + inherit (lib.nvim.dag) entryBefore; + inherit (lib.nvim.lua) toLuaObject; cfg = config.vim.lsp; usingNvimCmp = config.vim.autocomplete.nvim-cmp.enable; @@ -23,7 +25,7 @@ mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions; mkBinding = binding: action: if binding.value != null - then "vim.keymap.set('n', '${binding.value}', ${action}, {buffer=bufnr, noremap=true, silent=true, desc='${binding.description}'})" + then "vim.keymap.set('n', ${toLuaObject binding.value}, ${action}, {buffer=bufnr, noremap=true, silent=true, desc=${toLuaObject binding.description}})" else ""; in { config = mkIf cfg.enable { @@ -35,20 +37,26 @@ in { augroups = [{name = augroup;}]; autocmds = - (optional cfg.inlayHints.enable { - group = augroup; - event = ["LspAttach"]; - desc = "LSP on-attach enable inlay hints autocmd"; - callback = mkLuaInline '' - function(event) - local bufnr = event.buf - local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr }), { bufnr = bufnr }) + [ + { + group = augroup; + event = ["LspAttach"]; + desc = "LSP on-attach add keybinds, enable inlay hints, and other plugin integrations"; + callback = mkLuaInline '' + function(event) + local bufnr = event.buf + local client = vim.lsp.get_client_by_id(event.data.client_id) + default_on_attach(client, bufnr) + + ${optionalString cfg.inlayHints.enable '' + if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr }), { bufnr = bufnr }) + end + ''} end - end - ''; - }) + ''; + } + ] ++ (optional (!conformFormatOnSave) { group = augroup; event = ["BufWritePre"]; @@ -87,7 +95,7 @@ in { ''; }); - pluginRC.lsp-setup = '' + pluginRC.lsp-setup = entryBefore ["autocmds"] '' vim.g.formatsave = ${boolToString cfg.formatOnSave}; local attach_keymaps = function(client, bufnr) From 11fd1b7083136aabbe1ca393616c5d5128bd19a5 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Fri, 26 Sep 2025 00:28:21 +0200 Subject: [PATCH 07/53] lib/dag: improve dependency cycle error message --- lib/dag.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/dag.nix b/lib/dag.nix index cbf52083..db5d53b7 100644 --- a/lib/dag.nix +++ b/lib/dag.nix @@ -8,7 +8,7 @@ # - the addition of the function `entryBefore` indicating a "wanted # by" relationship. {lib}: let - inherit (builtins) isAttrs attrValues attrNames elem all head tail length toJSON isString; + inherit (builtins) isAttrs attrValues attrNames elem all head tail length toJSON isString removeAttrs; inherit (lib.attrsets) filterAttrs mapAttrs; inherit (lib.lists) toposort; inherit (lib.nvim.dag) empty isEntry entryBetween entryAfter entriesBetween entryAnywhere topoSort; @@ -169,10 +169,11 @@ in { else value) dag; sortedDag = topoSort finalDag; + loopDetail = map (loops: removeAttrs loops ["data"]) sortedDag.loops; result = if sortedDag ? result then mapResult sortedDag.result - else abort ("Dependency cycle in ${name}: " + toJSON sortedDag); + else abort ("Dependency cycle in ${name}: " + toJSON loopDetail); in result; } From c13edf9961fa8cfcd00c98a6b3b9dea2d9237bc4 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Fri, 26 Sep 2025 00:29:22 +0200 Subject: [PATCH 08/53] treewide: remove usage of default_on_attach outside LspAttach --- modules/neovim/init/lsp.nix | 1 - modules/plugins/languages/clang.nix | 4 ---- modules/plugins/languages/csharp.nix | 11 +++++------ modules/plugins/languages/dart.nix | 1 - modules/plugins/languages/haskell.nix | 4 +--- modules/plugins/languages/python.nix | 2 -- modules/plugins/languages/rust.nix | 1 - modules/plugins/languages/ts.nix | 3 --- modules/plugins/languages/yaml.nix | 20 ++++++++++---------- 9 files changed, 16 insertions(+), 31 deletions(-) diff --git a/modules/neovim/init/lsp.nix b/modules/neovim/init/lsp.nix index 6c18b98e..b17c5554 100644 --- a/modules/neovim/init/lsp.nix +++ b/modules/neovim/init/lsp.nix @@ -77,7 +77,6 @@ in { { vim.lsp.servers."*" = { capabilities = mkDefault (mkLuaInline "capabilities"); - on_attach = mkDefault (mkLuaInline "default_on_attach"); }; } diff --git a/modules/plugins/languages/clang.nix b/modules/plugins/languages/clang.nix index 487bc151..20e4fab1 100644 --- a/modules/plugins/languages/clang.nix +++ b/modules/plugins/languages/clang.nix @@ -26,8 +26,6 @@ workspace_required = true; on_attach = mkLuaInline '' function(client, bufnr) - default_on_attach(client, bufnr) - local function switch_source_header(bufnr) local method_name = "textDocument/switchSourceHeader" local params = vim.lsp.util.make_text_document_params(bufnr) @@ -77,8 +75,6 @@ }; on_attach = mkLuaInline '' function(client, bufnr) - default_on_attach(client, bufnr) - local function switch_source_header(bufnr) local method_name = "textDocument/switchSourceHeader" local client = vim.lsp.get_clients({ bufnr = bufnr, name = "clangd", })[1] diff --git a/modules/plugins/languages/csharp.nix b/modules/plugins/languages/csharp.nix index 9e13a5ef..bbfff251 100644 --- a/modules/plugins/languages/csharp.nix +++ b/modules/plugins/languages/csharp.nix @@ -63,12 +63,11 @@ }; on_attach = mkLuaInline '' function(client, bufnr) - default_on_attach(client, bufnr) - local oe = require("omnisharp_extended") - ${mkLspBinding "goToDefinition" "oe.lsp_definition"} - ${mkLspBinding "goToType" "oe.lsp_type_definition"} - ${mkLspBinding "listReferences" "oe.lsp_references"} - ${mkLspBinding "listImplementations" "oe.lsp_implementation"} + local oe = require("omnisharp_extended") + ${mkLspBinding "goToDefinition" "oe.lsp_definition"} + ${mkLspBinding "goToType" "oe.lsp_type_definition"} + ${mkLspBinding "listReferences" "oe.lsp_references"} + ${mkLspBinding "listImplementations" "oe.lsp_implementation"} end ''; settings = { diff --git a/modules/plugins/languages/dart.nix b/modules/plugins/languages/dart.nix index 52dcd560..ff665e7d 100644 --- a/modules/plugins/languages/dart.nix +++ b/modules/plugins/languages/dart.nix @@ -161,7 +161,6 @@ in { }, capabilities = capabilities, - on_attach = default_on_attach; }, ${optionalString cfg.dap.enable '' debugger = { diff --git a/modules/plugins/languages/haskell.nix b/modules/plugins/languages/haskell.nix index 600c7724..2b26640a 100644 --- a/modules/plugins/languages/haskell.nix +++ b/modules/plugins/languages/haskell.nix @@ -10,11 +10,10 @@ inherit (lib.strings) optionalString; inherit (lib.modules) mkIf mkMerge; inherit (lib.nvim.types) mkGrammarOption; - inherit (lib.nvim.dag) entryAfter entryBefore; + inherit (lib.nvim.dag) entryAfter; inherit (lib.nvim.lua) expToLua; inherit (lib.meta) getExe'; inherit (lib.generators) mkLuaInline; - inherit (lib.nvim.attrsets) mapListToAttrs; inherit (pkgs) haskellPackages; inherit (lib.nvim.lua) toLuaObject; @@ -34,7 +33,6 @@ '' function(client, bufnr) local ht = require("haskell-tools") - default_on_attach(client, bufnr, ht) local opts = { noremap = true, silent = true, buffer = bufnr } vim.keymap.set('n', 'cl', vim.lsp.codelens.run, opts) vim.keymap.set('n', 'hs', ht.hoogle.hoogle_signature, opts) diff --git a/modules/plugins/languages/python.nix b/modules/plugins/languages/python.nix index 8e1f0ebd..1bb7fdd2 100644 --- a/modules/plugins/languages/python.nix +++ b/modules/plugins/languages/python.nix @@ -42,7 +42,6 @@ }; on_attach = mkLuaInline '' function(client, bufnr) - default_on_attach(client, bufnr); vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightOrganizeImports', function() local params = { command = 'pyright.organizeimports', @@ -89,7 +88,6 @@ }; on_attach = mkLuaInline '' function(client, bufnr) - default_on_attach(client, bufnr); vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightOrganizeImports', function() local params = { command = 'basedpyright.organizeimports', diff --git a/modules/plugins/languages/rust.nix b/modules/plugins/languages/rust.nix index 09c54ae6..3a0a2a9e 100644 --- a/modules/plugins/languages/rust.nix +++ b/modules/plugins/languages/rust.nix @@ -160,7 +160,6 @@ in { ${cfg.lsp.opts} }, on_attach = function(client, bufnr) - default_on_attach(client, bufnr) local opts = { noremap=true, silent=true, buffer = bufnr } vim.keymap.set("n", "rr", ":RustLsp runnables", opts) vim.keymap.set("n", "rp", ":RustLsp parentModule", opts) diff --git a/modules/plugins/languages/ts.nix b/modules/plugins/languages/ts.nix index 40e598ae..3895c29a 100644 --- a/modules/plugins/languages/ts.nix +++ b/modules/plugins/languages/ts.nix @@ -50,8 +50,6 @@ }; on_attach = mkLuaInline '' function(client, bufnr) - default_on_attach(client, bufnr); - -- ts_ls provides `source.*` code actions that apply to the whole file. These only appear in -- `vim.lsp.buf.code_action()` if specified in `context.only`. vim.api.nvim_buf_create_user_command(0, 'LspTypescriptSourceAction', function() @@ -106,7 +104,6 @@ }; on_attach = mkLuaInline '' function(client, bufnr) - default_on_attach(client, bufnr) vim.api.nvim_buf_create_user_command(0, 'LspDenolsCache', function() client:exec_cmd({ command = 'deno.cache', diff --git a/modules/plugins/languages/yaml.nix b/modules/plugins/languages/yaml.nix index b06ef17f..ea9e65d0 100644 --- a/modules/plugins/languages/yaml.nix +++ b/modules/plugins/languages/yaml.nix @@ -15,18 +15,18 @@ cfg = config.vim.languages.yaml; - on_attach = mkLuaInline ( + on_attach = if config.vim.languages.helm.lsp.enable && config.vim.languages.helm.enable - then '' - function(client, bufnr) - default_on_attach() - local filetype = vim.bo[bufnr].filetype - if filetype == "helm" then - client.stop() + then + mkLuaInline '' + function(client, bufnr) + local filetype = vim.bo[bufnr].filetype + if filetype == "helm" then + client.stop() + end end - end'' - else "default_on_attach" - ); + '' + else null; defaultServers = ["yaml-language-server"]; servers = { From cd9a5da85217c63ea7b28cbf635d29fc8a680b1a Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 24 Sep 2025 12:28:40 +0300 Subject: [PATCH 09/53] flake: add ndg as an input Signed-off-by: NotAShelf Change-Id: I6a6a6964151352d958f0c64949769d98dd759bdc --- flake.lock | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 3 ++ 2 files changed, 89 insertions(+), 1 deletion(-) diff --git a/flake.lock b/flake.lock index 9528e9b7..e3bf262f 100644 --- a/flake.lock +++ b/flake.lock @@ -16,6 +16,21 @@ "url": "https://git.lix.systems/lix-project/flake-compat.git" } }, + "flake-compat_2": { + "locked": { + "lastModified": 1747046372, + "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -36,6 +51,24 @@ "type": "github" } }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1756770412, + "narHash": "sha256-+uWLQZccFHwqpGqr2Yt5VsW/PbeJVTn9Dk6SHWhNRPw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "4524271976b625a4a605beefd893f270620fd751", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "mnw": { "locked": { "lastModified": 1756659871, @@ -51,7 +84,58 @@ "type": "github" } }, + "ndg": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-parts": "flake-parts_2", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1758451644, + "narHash": "sha256-sP4hBXifUIrEk37N+NRp3p42Os4OahX/8w1CN74nig8=", + "owner": "feel-co", + "repo": "ndg", + "rev": "a7c8f6ca855335c4dff4826a0245ee93e1816b70", + "type": "github" + }, + "original": { + "owner": "feel-co", + "repo": "ndg", + "type": "github" + } + }, "nixpkgs": { + "locked": { + "lastModified": 1757745802, + "narHash": "sha256-hLEO2TPj55KcUFUU1vgtHE9UEIOjRcH/4QbmfHNF820=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c23193b943c6c689d70ee98ce3128239ed9e32d1", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1754788789, + "narHash": "sha256-x2rJ+Ovzq0sCMpgfgGaaqgBSwY+LST+WbZ6TytnT9Rk=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "a73b9c743612e4244d865a2fdee11865283c04e6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1756696532, "narHash": "sha256-6FWagzm0b7I/IGigOv9pr6LL7NQ86mextfE8g8Q6HBg=", @@ -72,7 +156,8 @@ "flake-compat": "flake-compat", "flake-parts": "flake-parts", "mnw": "mnw", - "nixpkgs": "nixpkgs", + "ndg": "ndg", + "nixpkgs": "nixpkgs_2", "systems": "systems" } }, diff --git a/flake.nix b/flake.nix index 35820e0b..31e8d0f1 100644 --- a/flake.nix +++ b/flake.nix @@ -105,5 +105,8 @@ # Alternate neovim-wrapper mnw.url = "github:Gerg-L/mnw"; + + # Alternative documentation generator + ndg.url = "github:feel-co/ndg"; }; } From 11d0292539091e93b7711e3d1ab084f055b6745a Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 26 Sep 2025 15:04:21 +0300 Subject: [PATCH 10/53] docs: adapt builder functions for ndg Signed-off-by: NotAShelf Change-Id: I6a6a6964720fae8f3db129835efa5d5df956c3ef --- docs/default.nix | 2 +- docs/manual.nix | 182 ++++++++++++++++++++++++----------------------- 2 files changed, 94 insertions(+), 90 deletions(-) diff --git a/docs/default.nix b/docs/default.nix index 49f90b80..662dd403 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -92,7 +92,7 @@ # Generate the HTML manual pages html = pkgs.callPackage ./manual.nix { - inherit release; + inherit inputs release; inherit (nvimModuleDocs) optionsJSON; }; in { diff --git a/docs/manual.nix b/docs/manual.nix index 50a5dab4..1ce89126 100644 --- a/docs/manual.nix +++ b/docs/manual.nix @@ -1,114 +1,118 @@ { - lib, + inputs, stdenvNoCC, - fetchzip, runCommandLocal, # build inputs - nixos-render-docs, - documentation-highlighter, - dart-sass, path, # nrd configuration release, optionsJSON, } @ args: let manual-release = args.release or "unstable"; +in + runCommandLocal "hjem-docs" { + nativeBuildInputs = [inputs.ndg.packages.${stdenvNoCC.system}.ndg]; + } '' + mkdir -p $out/share/doc - scss-reset = fetchzip { - url = "https://github.com/Frontend-Layers/scss-reset/archive/refs/tags/1.4.2.zip"; - hash = "sha256-cif5Sx8Ca5vxdw/mNAgpulLH15TwmzyJFNM7JURpoaE="; + # Copy the markdown sources to be processed by ndg + cp -rvf ${./manual} ./manual + + substituteInPlace ./manual/options.md \ + --subst-var-by OPTIONS_JSON ./config-options.json + + substituteInPlace ./manual/index.md \ + --subst-var-by NVF_VERSION ${manual-release} + + substituteInPlace ./manual/hacking/additional-plugins.md \ + --subst-var-by NVF_REPO "https://github.com/notashelf/nvf/blob/${manual-release}" + + ndg html \ + --jobs $NIX_BUILD_CORES --title "NVF" \ + --module-options ${optionsJSON}/share/doc/nixos/options.json \ + --manpage-urls ${path}/doc/manpage-urls.json \ + --options-depth 3 \ + --generate-search true \ + --highlight-code true \ + --input-dir ./manual \ + --output-dir "$out/share/doc" + + # Hydra support. Probably not necessary. + mkdir -p $out/nix-support/ + echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products + '' +/* +stdenvNoCC.mkDerivation { + name = "nvf-manual"; + src = builtins.path { + name = "nvf-manual-${manual-release}"; + path = lib.sourceFilesBySuffices ./manual [".md" ".md.in"]; }; - compileStylesheet = runCommandLocal "compile-nvf-stylesheet" {} '' - mkdir -p $out + strictDependencies = true; + nativeBuildInputs = [nixos-render-docs]; - tmpfile=$(mktemp -d) - trap "rm -r $tmpfile" EXIT - - ln -s "${scss-reset}/build" "$tmpfile/scss-reset" - - ${dart-sass}/bin/sass --load-path "$tmpfile" \ - ${./static/style.scss} "$out/style.css" - - echo "Generated styles" + postPatch = '' + ln -s ${optionsJSON}/share/doc/nixos/options.json ./config-options.json ''; -in - stdenvNoCC.mkDerivation { - name = "nvf-manual"; - src = builtins.path { - name = "nvf-manual-${manual-release}"; - path = lib.sourceFilesBySuffices ./manual [".md" ".md.in"]; - }; - strictDependencies = true; - nativeBuildInputs = [nixos-render-docs]; + buildPhase = '' + dest="$out/share/doc/nvf" + mkdir -p "$(dirname "$dest")" + mkdir -p $dest/{highlightjs,script} - postPatch = '' - ln -s ${optionsJSON}/share/doc/nixos/options.json ./config-options.json - ''; + # Copy highlight scripts to /highlights in document root. + cp -vt $dest/highlightjs \ + ${documentation-highlighter}/highlight.pack.js \ + ${documentation-highlighter}/LICENSE \ + ${documentation-highlighter}/mono-blue.css \ + ${documentation-highlighter}/loader.js - buildPhase = '' - dest="$out/share/doc/nvf" - mkdir -p "$(dirname "$dest")" - mkdir -p $dest/{highlightjs,script} + # Copy anchor scripts to the script directory in document root. + cp -vt "$dest"/script \ + ${./static/script}/anchor-min.js \ + ${./static/script}/anchor-use.js \ + ${./static/script}/search.js - # Copy highlight scripts to /highlights in document root. - cp -vt $dest/highlightjs \ - ${documentation-highlighter}/highlight.pack.js \ - ${documentation-highlighter}/LICENSE \ - ${documentation-highlighter}/mono-blue.css \ - ${documentation-highlighter}/loader.js - # Copy anchor scripts to the script directory in document root. - cp -vt "$dest"/script \ - ${./static/script}/anchor-min.js \ - ${./static/script}/anchor-use.js \ - ${./static/script}/search.js - substituteInPlace ./options.md \ - --subst-var-by OPTIONS_JSON ./config-options.json + # Move compiled stylesheet + cp -vt $dest \ + ${compileStylesheet}/style.css - substituteInPlace ./manual.md \ - --subst-var-by NVF_VERSION ${manual-release} + # Move release notes + cp -vr ${./release-notes} release-notes - substituteInPlace ./hacking/additional-plugins.md \ - --subst-var-by NVF_REPO "https://github.com/notashelf/nvf/blob/${manual-release}" + # Generate final manual from a set of parameters. Explanation of the CLI flags are + # as follows: + # + # 1. --manpage-urls will allow you to use manual pages as they are defined in + # the nixpkgs documentation. + # 2. --revision is the project revision as it is defined in 'release.json' in the + # repository root + # 3. --script will inject a given Javascript file into the resulting pages inside + # the