Skip to content

[audit] Fix fff.nvim PackChanged listener — use User autocmd pattern - #133

Closed
stanfish06 wants to merge 1 commit into
masterfrom
audit/pack-changed-user-event
Closed

stanfish06 wants to merge 1 commit into
masterfrom
audit/pack-changed-user-event

Conversation

@stanfish06

Copy link
Copy Markdown
Owner

What

vim.pack fires a User event with pattern PackChanged, not a first-class PackChanged event. The autocmd in lua/config/plugin_config.lua was listening for "PackChanged" as the event name — which is a non-existent event and never fires. As a result, fff.nvim's binary was never downloaded after SyncPkgs installed or updated the plugin.

Where

lua/config/plugin_config.lua — the fff section, around line 150.

Why it matters

Without this fix, require("fff.download").download_or_build_binary() is never called automatically. The user would need to manually invoke the download after every SyncPkgs run.

Change

-    vim.api.nvim_create_autocmd("PackChanged", {
+    vim.api.nvim_create_autocmd("User", {
+        pattern = "PackChanged",

Fixes #117.


Generated by Claude Code

vim.pack fires a User event with pattern PackChanged, not a first-class
PackChanged event. The old listener never fired, so fff.nvim's binary
was never downloaded after install/update.

Fixes #117

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1dad9f7268

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +150 to +151
vim.api.nvim_create_autocmd("User", {
pattern = "PackChanged",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore the PackChanged event for vim.pack hooks

When vim.pack installs or updates fff.nvim (for example through SyncPkgs), this autocmd now listens for the User event instead of the actual PackChanged event, so the callback will not run and the fff binary still will not be downloaded. I checked the current Neovim pack/autocmd docs: PackChanged and PackChangedPre are first-class autocmd events, and the documented hook example uses vim.api.nvim_create_autocmd('PackChanged', ...) with this same ev.data shape.

Useful? React with 👍 / 👎.

@stanfish06 stanfish06 closed this Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[audit] PackChanged autocmd in fff.nvim setup is a top-level event — should be User PackChanged — binary never downloaded on install

2 participants