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

Should the auto format auto cmd be in the augroup_format group? #31

Open
jjant opened this issue Jan 25, 2023 · 1 comment
Open

Should the auto format auto cmd be in the augroup_format group? #31

jjant opened this issue Jan 25, 2023 · 1 comment

Comments

@jjant
Copy link

jjant commented Jan 25, 2023

See:

local augroup_format = vim.api.nvim_create_augroup("custom-lsp-format", { clear = true })
local augroup_semantic = vim.api.nvim_create_augroup("custom-lsp-semantic", { clear = true })
local autocmd_format = function(async, filter)
vim.api.nvim_clear_autocmds { buffer = 0, group = augroup_format }
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = 0,
callback = function()
vim.lsp.buf.format { async = async, filter = filter }
end,
})
end

I think you're missing the group = augroup_format in line 46.

@jjant
Copy link
Author

jjant commented Jan 25, 2023

Ah, I think it works fine for you because you're attaching/clearing to/from buffer = 0. But then it seems like you don't need the augroup 🤔

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

No branches or pull requests

1 participant