From 3f2ab6ef96f4544d19a3fc2ed8b8551b6849aed3 Mon Sep 17 00:00:00 2001 From: Daniel <22460147+dwinkler1@users.noreply.github.com> Date: Sun, 26 Jul 2026 06:47:58 +0000 Subject: [PATCH] fix: address R1 (image.nvim backend) + C4 (cat-gate consistency) Tackles the two outstanding items from the post-fix consistency pass on top of `df2f776`. * R1 -- plugin/27_image.lua: removed the explicit `backend = "auto"` line. image.nvim's setup() does not accept "auto" / "none" as literal values; the practical default is to leave `backend` unset, letting image.nvim auto-detect the right graphics protocol (kitty / wezterm / iterm / sixel) at runtime and falling back to no rendering on unsupported terminals. Inline comment explains the omission so a future reader doesn't "fix" it back. * C4 -- modules/module/specs/plugins.nix: - Removed `nvim-dap`, `nvim-dap-ui`, `nvim-dap-virtual-text`, and `image-nvim` from `config.specs.utils-lazy`. They are R- and Markdown-specific, not general utility plugins, so they should not depend on `utils=true`. - Added a new `config.specs.r-lazy` spec carrying those same four plugins, gated by `cats.r`. Users with `r=true` and `utils=false` now get a working R debugger (via vscDebugger) and in-buffer image rendering for plots. - Added `image-nvim` to the existing `config.specs.markdown-lazy` so users with `markdown=true` and no other cats still see inline plots in Quarto / Markdown documents. nixCats dedups packages by pname, so `image-nvim` appears once on the runtime path even when both `r` and `markdown` are on. These two changes close the real correctness bugs surfaced by the consistency review: `plugin/26_dap.lua` and `plugin/27_image.lua`'s cat-gated `Config.add(...)` calls previously depended on `utils=true` resolving the four packages, leaving `r=true` (or `markdown=true`) only users without DAP / image-nvim even though the Lua gate let the setup function proceed. Files: 2 modified. Local verification (`nix flake check --no-build`) still required before merging PR #12. --- modules/module/specs/plugins.nix | 14 ++++++++++++-- plugin/27_image.lua | 6 +++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/modules/module/specs/plugins.nix b/modules/module/specs/plugins.nix index 4a3324a..ff072cc 100644 --- a/modules/module/specs/plugins.nix +++ b/modules/module/specs/plugins.nix @@ -70,6 +70,7 @@ in { lazy = true; data = [ config.nvim-lib.neovimPlugins.cmp-pandoc-references + pkgs.vimPlugins.image-nvim ]; }; @@ -184,11 +185,20 @@ in { colorful-menu-nvim conform-nvim copilot-lua + nvim-lint + vim-slime + ]; + }; + + -- Lazy-loaded plugins needed when the `r` cat is on. Kept separate from + -- `utils-lazy` so users with `r=true` and `utils=false` still get the + -- R debugger (via vscDebugger) and in-buffer image rendering for plots. + config.specs.r-lazy = lib.mkIf (config.cats.r or false) { + lazy = true; + data = with pkgs.vimPlugins; [ nvim-dap nvim-dap-ui nvim-dap-virtual-text - nvim-lint - vim-slime image-nvim ]; }; diff --git a/plugin/27_image.lua b/plugin/27_image.lua index 18a424a..89e0d2f 100644 --- a/plugin/27_image.lua +++ b/plugin/27_image.lua @@ -24,7 +24,11 @@ later(function() end image.setup({ - backend = "auto", + -- Backend is intentionally NOT set so image.nvim auto-detects the + -- graphics protocol (kitty / wezterm / iterm / sixel) at runtime and + -- falls back to no rendering on unsupported terminals. The literal + -- strings "auto" / "none" are not accepted by image.nvim.setup(), so + -- setting either would silently disable rendering everywhere. integrations = { markdown = { enabled = true,