how to auto format afte save #3120
Answered
by
dpetka2001
woshichuanqilz
asked this question in
Q&A
-
here is my config in the config file. vim.api.nvim_create_augroup("format json", {})
vim.api.nvim_clear_autocmds({ group = "format json" })
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = "*.json",
callback = function()
vim.lsp.buf.format()
end,
group = "format json",
desc = "format json",
})
The json lsp server is installed by mason which is But I still get the error msg |
Beta Was this translation helpful? Give feedback.
Answered by
dpetka2001
May 9, 2024
Replies: 1 comment 2 replies
-
You should configure your formatter of choice in |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should just create a file
~/.config/nvim/lua/plugins/format.lua
with contents