Skip to content

[audit] vim.pack has no lazy-loading — fff.nvim lazy=true is silently ignored when vim.pack is active #270

Description

@stanfish06

What

plugins.lua:9 marks fff.nvim as lazy:

{
    name = "fff.nvim",
    src = "https://github.com/dmtrKovalenko/fff.nvim",
    lazy = true,          -- <-- this field
    version = vim.version.range("0.9.4"),
},

The old git-clone fallback path (lines 89–110) reads the lazy field and places fff.nvim in pack/plugins/opt/ (opt = lazy, start = eager). That works correctly.

However, vim.pack.add() — the Neovim 0.12 native package manager path — does not support lazy-loading at all (confirmed in the official vim.pack documentation and guides). There is no lazy field in the vim.pack spec; the field is silently ignored. When vim.pack is active, fff.nvim is installed into the start directory and loaded at startup, defeating the intent.

Where

  • lua/config/plugins.lua:9lazy = true on fff.nvim spec
  • lua/config/plugins.lua:89 — old path correctly uses entry.lazy to pick opt/ vs start/
  • lua/config/plugins.lua:75 — vim.pack path calls vim.pack.add(package_list) without any lazy handling
  • lua/config/plugins.lua:128-132 — the packadd loop at startup would also need to skip lazy plugins

Why it matters

fff.nvim requires downloading and/or building a Rust binary (require("fff.download").download_or_build_binary()). Loading it unconditionally at startup adds binary-download overhead and a Rust toolchain requirement to every Neovim startup, even when fff.nvim is never used. The lazy = true annotation exists precisely to avoid this. On the vim.pack path that intent is lost.

Recommended action

Option A — Remove lazy entirely: Accept that fff.nvim loads at startup on both paths. Add the PackChanged autocmd (already present at plugin_config.lua:212–222) to handle first-time binary builds. Update the comment to explain the limitation.

Option B — Defer loading manually: Remove fff.nvim from package_list and instead use a separate packadd-on-demand call inside the fff_call() wrapper in plugin_config.lua:227–239. This is effectively the vim.pack-compatible equivalent of lazy-loading:

local function fff_call(fn)
    return function()
        vim.cmd.packadd("fff.nvim")  -- idempotent after first call
        local fff_ok, fff = pcall(require, "fff")
        if not fff_ok then
            vim.notify("fff.nvim is not installed (run :SyncPkgs)", vim.log.levels.WARN)
            return
        end
        fff[fn]()
    end
end

Option C — Wait for vim.pack lazy support: vim.pack is still experimental; lazy-loading may be added in a future Neovim release. File a Neovim issue upstream and track it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions