package-info.nvim icon indicating copy to clipboard operation
package-info.nvim copied to clipboard

[BUG] register-autocmd.lua func hardcodes package.json as the autocmd pattern even for ColorScheme events

Open GitMurf opened this issue 1 year ago • 1 comments

Issues

  • [X] I have checked existing issues and there are no issues with the same problem.

Plugin Version

  • [X] I am using the latest version of the plugin

Neovim Version

  • [X] I am using the 0.6 neovim version or later

Neovim Version

0.11

Branch

master

Actual behavior

https://github.com/vuki656/package-info.nvim/blob/018bc10e28b00e28e239b1fff7c497304f8b1bf5/lua/package-info/utils/register-autocmd.lua#L7

The helper for registering autocmds has a pattern hardcoded of "package.json" (see permalink above) like this: vim.cmd("autocmd " .. constants.AUTOGROUP .. " " .. event .. " package.json " .. command)

This works for the BufEnter autocmds but does not work for the ColorScheme autocmds as the pattern looks to match on the name of the color scheme and NOT the buffer name (package.json).

Here is where it is called during the __register_colorscheme_initialization function: https://github.com/vuki656/package-info.nvim/blob/018bc10e28b00e28e239b1fff7c497304f8b1bf5/lua/package-info/config.lua#L129

So this ColorScheme autocmd never actually fires unless you had a color scheme / theme named "package.json" 😉

Expected behavior

Need to use something like * instead of package.json when registering autocmd for ColorScheme.

Steps to reproduce

Try changing color scheme and the autocmd will not fire.

Package info config

defaults

Other information

No response

Help

No, sorry.

Implementation help

No response

GitMurf avatar Aug 06 '24 06:08 GitMurf

Hey, would you be willing to open a PR to fix this?

vuki656 avatar Aug 08 '24 06:08 vuki656