vuki656 / package-info.nvim

✍️ All the npm/yarn/pnpm commands I don't want to type
GNU General Public License v3.0
487 stars 28 forks source link

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

Open GitMurf opened 3 months ago

GitMurf commented 3 months ago

Issues

Plugin Version

Neovim Version

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

vuki656 commented 3 months ago

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