Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure all created autocmds are part of the Neogit augroup #606

Merged
merged 2 commits into from
Jul 16, 2023

Conversation

PriceHiller
Copy link
Contributor

Prior to this PR using vim.api.nvim_get_autocmds({ group = "Neogit" }) would only return the initial setup autocmds that Neogit created. It did not return the autocmds created for the buffers that Neogit created.

This PR enables users to get all the autocmds that Neogit creates. It does this by exporting the augroup in autocmds.lua and then importing it in buffer.lua so they share the same augroup.

Something to note, we may want to create a different augroup for the Neogit buffers in buffer.lua instead of using the same augroup in autocmds.lua, though it may make it a bit more difficult to search for.

@CKolkey
Copy link
Member

CKolkey commented Jul 15, 2023

The only thing I'd say is to move the group into the setup, since I kinda have short-term plans to remove that autocmds file. You can check that out here CKolkey#44 if you're curious. Otherwise this makes perfect sense :)

@PriceHiller
Copy link
Contributor Author

Do you mean within the setup function in autocmds.lua or elsewhere? Like the setup function in the primary file?

The only other convenient place I see to set the augroup is in the config table.

@CKolkey
Copy link
Member

CKolkey commented Jul 15, 2023

Sorry, I mean the setup function for the plugin: https://github.com/NeogitOrg/neogit/blob/master/lua/neogit.lua

Then export it from the module, and consume it where needed. Or something like that.

@PriceHiller
Copy link
Contributor Author

@CKolkey done. Take a look and let me know what you think.

@CKolkey CKolkey merged commit 7ec7dde into NeogitOrg:master Jul 16, 2023
3 checks passed
@CKolkey
Copy link
Member

CKolkey commented Jul 16, 2023

I think it looks great :D

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.

2 participants